Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 4 years ago.
Improve this question
I am a newbie in Linux. Whats is the complete process to zip and unzip a directory and its files? Please mention if any installation has to be done.
To zip a folder and it's contents recursively:
zip -r archivefile foldername
To unzip a zip file:
unzip archivefile
I had alot of trouble using unzip giving me errors like
sql.zip has more than one entry--rest ignored
Etc.
Using php worked like a sharm. Oneliner:
php -r '$zip = new ZipArchive; $zip->open("db.sql.zip"); $zip->extractTo("./"); $zip->close(); echo "Yay!";'
Run in cmd / terminal after php is installed
Several options exist, the most common ones:
On CLI (command line interface) there are the two utilities zip and unzip which do the obvious thing. For example to compress a directory "my-folder" with all its content using the zip algorithm you would do a zip -r my-folder.zip myfolder. To uncompress it your would use unzip my-folder.zip. Paths are always relative to the current working directory, so where you execute the command. Take a look at the "man page" to find out about the usage: man zip.
There are also GUI utilities (so utilities with a graphical user interface), but it depends on what desktop environment you use, since they are typically integrated. There is ark for KDE and a differente service menus that can be used for example in the file manager dolphin. There certainly are similar solutions for desktop environments like GNOME or Unity.
The question what packages you have to install depends a bit on the Linux distribution you use. The package names may vary slightly, but in general you certainly should be able to find the "zip" package in your local package management system.
Related
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 4 years ago.
Improve this question
I am new to linux and trying to understand.....
I have got a software package for CentOs7 which I need to install (according to the manual) by calling ./install.sh which is in my current directory, when doing so everything works OK.
AFAIK, in Linux ./ means current directory, so why am I getting install.sh: Command not found when just calling install.sh (i.e. without ./) from the current directory?
In Linux, UNIX and related operating systems, . denotes the current directory. Since you want to run a file in your current directory
you need the ./ bit to tell the shell where the executable is.
So, ./install.sh means run the executable called install.sh that is in this directory.
PS: If your current dictionary is registered in $PATH, you don't need to use ./install.sh just install.sh is enough
If you want to just call install.sh or any other script with ./ then the same should be in the bin folder. If the script is in any other directory, then ./ is must.
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 8 years ago.
Improve this question
I am playing around with an open-source software, FSL. I have no problems running it on my Mac, where I am able to simply start it by typing fsl in the terminal.
However, I have no idea how to start the software on our school's HPC server. After logging into the school server via SSH, I type fsl as usual, and then
If 'fsl' is not a typo you can run the following command to lookup the package that contains the binary:
command-not-found fsl
-bash: fsl: command not found
Then, I navigate into the FSL installation directory (/data/apps/arch/Linux_x86_64/fsl/5.0.6) and type fsl. Still the same error. I have also tried
module load /data/apps/arch/Linux_x86_64/fsl/5.0.6
But this error occurs.
utility.c(2360):ERROR:50: Cannot open file '' for 'reading'
utility.c(2360):ERROR:50: Cannot open file '' for 'reading'
...
How should I load it properly and ultimately run it?
You have to call the executable with the correct path. You may either
cd to the directory containing the executable
prefix the executable's name with the path ./fsl
or (if you intend to use the executable frequently):
add the executable's path to your PATH-environment variable (export PATH=$PATH:/path/to/the/folder/containing/the/executable)
use the executable's name to call it (fsl).
or you place a symlink to your executable somewhere the $PATH already points to:
Check $PATH with echo ${PATH} (outputs a colon-separated list of directories the command line processor will look for your call)
If there is ~/bin in there, place a symlink: ln -s /path/to/your/executable/fsl ~/bin/fsl.
The command line processor will search the directories listed in ${PATH} for an executable called somecommand if you type somecommand.
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 9 years ago.
Improve this question
I'm a user of Ubuntu 12.04 LTS and in a future a user of Ubuntu 14.04 LTS.
I have a problem, when I run Ubuntu my .bashrc script doesn't work unless I open the terminal.
This is a problem because, for example, the paths I write doesn't work unless I execute the programs from the terminal.
Are there an user config startup file for Ubuntu and not for the terminal?
P.D.:Maybe I don't explain very well, in other words, I'd like to execute mi scripts on Ubuntu startup without using the terminal.
Shell initialisation files (.profile, .bashrc, etc.) are intended for preparing the user's (interactive) environment.
For standalone scripts, it's better to make them independent from the environment, including
$HOME, $PATH, etc.
If you need to share code (functions, configuration) with other scripts, store that in a separate
shell library that you source from a known location, either through a fixed path or from a
path relative to the script's own location.
you can add the line below at the start of your script file
source ~/.bashrc
grep '/etc/bashrc' ~/.bashrc
if [ -f /etc/bashrc ]; then
. /etc/bashrc # --> Read /etc/bashrc, if present.
by default /etc/bashrc gets loaded when opening a console.
What are you trying to do - if you want to do something without it being executed as part of a console and more to do with system startup ? then you need to look into modifying existing service or adding a new service.
If this is related to when users ssh or connect it via console then its be bashrc file
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 9 years ago.
Improve this question
I have vim 7.0 on my server machine and I don't have root permissions. So, I have extracted Vim73 to my home directory and installed using the following command without having any errors.
./configure --prefix=$HOME && make && make install
But still if I open vim it is showing the older version.
How can my .vimrc file read the latest version installed from local user (home)?
You need to add your home to your path:
export PATH=$HOME/bin:$PATH
If vim installs shared libraries, you'll also need to add your local libs path to your LD_LIBRARY_PATH:
export LD_LIBRARY_PATH=$HOME/lib:$HOME/lib64:$LD_LIBRARY_PATH
Choose lib or lib64 depending on what's present on your system.
Alternatively, call the binary with its absolute path:
$HOME/bin/vim
Create an alias in your .bashrc or .zshrc, ...
alias vim="/path/to/your/vim"
Configure the PATH variable to include the path to the locally installed vim. Or create an alias alias vim = /path/to/local/vim.
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 7 years ago.
Improve this question
How do I recreate an rpm which is already installed on a system on linux?
What version of RPM are you using? If you're using a newer one, I have a trick that might work for you.
Newer versions of RPM have a transaction safe rollback option; simply use the --repackage command, and it'll generate a package that includes all the idiosyncratic crap of the original install. Mind you, you'll have to actually DO something (e.g rpm -e --repackage rpm_goes_here which will ERASE the original, while making a package which you SHOULD be able to restore (after you've made a copy), but if you expect this to work perfectly, I have a BRIDGE you might want to buy), so it's a bit of a leap of faith if you don't have a full backup.
There is some configuration involved, and you need to test test test before you try this on something critical, but this may work.
Basically you will have to do the following:
1] Create a .spec file with all the headers [ http://www.rpm.org/max-rpm/s1-rpm-build-creating-spec-file.html ]
You will have to use the rpm -q --queryformat "" to get the header from the already installed rpm.
Eg. rpm -q --queryformat "Release: %{RELEASE}\n" installed_rpm
For getting the files to fill the %files Section use the rpm -ql command.
2] run rpmbuild -bb specfile to generate the rpm file.
Best way to recreate an RPM, is to do it from the source RPM. Great tutorial here.
The deltarpm package can do that:
A deltarpm contains the difference between an old and a new version of
a rpm, which makes it possible to recreate the new rpm from the
deltarpm and the old one. You don't have to have a copy of the old
rpm, deltarpms can also work with installed rpms.