-
Notifications
You must be signed in to change notification settings - Fork 6
Useful Unix commands
Below you will find a list of some of the most frequently used commands when using LSNM in a Unix/Linux workstation. Please note that they are not meant to be exhaustive and that some of them apply only if you are located within the NIH computer network.
$ tar -cvzf file_name.tar.gz directory_name
$ tar -xzvf file_name.tar.gz
$ scp username@remote.server.com:/home/username/myfile .
$ scp mylocalfile username@remote.server.com:/home/username
To run a GUI-based program remotely, you need to tunnel the X-windows connection through the SSH connection as follows:
$ ssh -X username@remote.server.com
After pressing <Enter>, you will have to provide your remote server password.
How to execute same command on a number of files using a unix (bash) script loop. Let's say we want to execute
the script 'netgen.py' on all files in current directory with extension 'ws':
$ for file in *.ws; do
$ python netgen.py $file
$ done
First, log in to the remote server using 'ssh' (see above), then execute the command 'screen' to open a virtual screen, then execute your command using 'nohup':
$ nohup python python_script.py &
Now you can disconnect from you screen typing <Ctrl><a><d>, which will disconnect you from the virtual screen. You can log out and later come back to the same virtual screen to check on your job(s) by typing:
$ screen -RD
About
Getting Started
Essentials
Tutorials
Extras