Basic UNIX commands reminder
Connecting to the front-end machines of the clusters:
Note: you have to replace
<user_name> with your UNIL user name.
Navigating the directory tree:
pwdprint's the current working directory. Useful to see where you currently are.
cd <directory>change working directory to <directory>.
cd ..move one directory up.
cd ~change working directory to your home directory.
List the content of a directory: Note: if you don't specify any
<directory> in the commands below the content of the current
directory is listed.
ls <directory>list content of specified directory.
ls -l <directory>list content in greater details.
Creating and copying/moving files and directories:
mkdir <directory name>create a new directory.
touch <new file>create an empty file named
mv <file> <destination>moves <file> to the specified <destination>
cp <file> <copy name>creates a copy of <file> named
. if is a directory then the file is copied to the specified directory and keeps the same name as the original.
cp -r <directory> <new path>copies an entire <directory> to the specified new location.
Copying files from a local machine to the cluster: The following command will copy
<fileName> to your home directory in the cluster. To copy files
to a different directory, replace
~ with the
scp <fileName> <userName>@wally-front1.unil.ch:~
Display file content in terminal:
cat <file>prints the entire content of <file> to the terminal.
less <file>opens <file> with the
lessprogram where you can scroll down/up the file. Press
qto exit less. This is useful to look at larger files.
head <file>print the first 10 lines of <file> to the terminal.
tail <file>print the last 10 lines of <file> to the terminal.
Simple text editors available on most GNU-Linux machines:
nano: follow the instructions given at the bottom of the terminal, e.g.
Ctrl + oto save your edits and
Ctrl + xto exit nano.
ito enter edit mode and
Escto exit edit mode. In the non-edit mode, press
:wqto save your edits and exit vim, or
:q!to exit without saving your changes.
Change file permissions:
chmod a+x <file>add execution permissions to file.
chmod a-x <file>remove execution permissions to file.
chmod a+w <file>add write permissions to file.
chmod a-w <file>remove write permissions to file.
If you need more background information on UNIX, the following e-learning module is available here.