-
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.
$ 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 -S <screen-name>
to open a virtual screen. Then execute your desired script(s) 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 logging in with 'ssh' and then typing:
$ screen -d -R <screen-name>
Do not forget to close your screen after you are finished with the jobs and data has been saved, by typing:
$ exit
About
Getting Started
Essentials
Tutorials
Extras