UNIX evalutation
UNIX evaluation exercise
Participants attending the HPC workshop are required to have some basic UNIX knowledge.
It is therefore recommended to follow a UNIX tutorial, such as the UNIX Fundamentals self-learning module.
Please find below a small evaluation exercise, which has to be completed _before_ attending the workshop.
The UNIX commands that may be useful are:
wget (or curl on MacOS X), tar, mkdir, cp, scp, pwd, ls, mv, less (or more), cat, chmod, history.
It is also necessary to know how to edit a file from the terminal window using nano, vi or emacs.
1) Download the following archive _from the command line_ :
ftp://ftp.vital-it.ch/edu/HPC/unix_eval.tar.gz
2) Extract the files from the archive. The 'unix_ex' directory has the following structure:
|___dir1/
|___dir2/
| |___docs/
| | |___scripts/
| | | |___cal.sh
| | | |___date.sh
| | |___texts/
| |___pictures/
3) Create a new directory - at the same level as the unix_ex - and name it 'mydir'
4) Copy the 'dir2' directory (including all its content) in the 'mydir' directory you just created using one command to get the following structure:
|___dir2/
| |___docs/
| | |___scripts/
| | | |___cal.sh
| | | |___date.sh
| | |___texts/
| |___pictures/
4b) [bonus question / optional] How could you copy _only_ the file 'unix_ex/dir2/docs/scripts/date.sh' and its directory tree - unix_ex/dir2/docs/scripts/' - using only one unix command to get the following structure?
|___unix_ex/
| |___dir2/
| | |___docs/
| | | |___scripts/
| | | | |___date.sh
5) Display the content of the file 'mydir/dir2/docs/scripts/date.sh' on the terminal window.
6) Rename the file 'mydir/dir2/docs/scripts/date.sh' to 'hostname.sh'
7) Edit the file 'hostname.sh': change the line 'date' to 'hostname'
8) Try to execute the following script::
'./mydir/dir2/docs/scripts/hostname.sh'
Did you succeed? Modify the file permissions accordingly so that the script can be executed
Finally, send by email all the UNIX commands you used for points 1-8.