Task 1: Brief introduction to basic Unix commands
This page briefly introduces Unix commands for HPC users without previous knowledge.
Pre-requisites:
Review this one-hour-long detailed introduction to VIM editor: Vim Tutorial
(optional) Familiarity with one unix text editors (for example Vi/Vim or Nano):
Installing Putty and connecting to the HPC (Windows users; Mac users can directly use the available ‘terminal’ app)
Install Putty:
Connect to the HPC:
Log into the HPC
ssh userID@lyra.qut.edu.au
Brief basic Unix commands
Once you log into the HPC, you will land in your personal home space (i.e. /home/myStudentID/). This space is only accessible to you. To work in collaboration with others we use workspaces (i.e. /work/myProjectName/).
To go to a shared directory for your team, for example type the following command and hit enter:
cd /work/trtp
Display list of files/directories in a directory
ls -lh
Print working directory
pwd
Go to a sandpit folder
cd sandpit/
check available files and folders
ls -lhtr
Create a folder
mkdir myname
Enter new folder
cd myname/data
#check working directory path
pwd
Move back to the previous folder(s)
cd ..
cd ../../
Make a backup copy of the file
cp launch_ENA_download.pbs ./myname/data
#check that file has been copied
ls -lh ./myname/data
View the content of a file (note hashtags # at the start of a line is used to provide information of the code underneath it - the commented lines are not executed)
#hash tags are used to add comments on what a command line does
#several commands can be used including cat, less, more, head and tail
cat myfile_copy.txt
#example: less -S allows to visualise very large (wide) files
less -S myfile_copy.txt
#stop viewing a file using the above command
--> Type “Control” and “c” at the same time.
Or “Control” and “d” at the same time.
#print the first 5 lines of a file
head -5 myfile_copy.txt
#print the last 5 lines of a file
tail -5 myfile_coy.txt
Go back to my personal space. Type 'cd' and hit enter. This will move you to /home/mystudentID/
cd
(Optional) Interactive session:
qsub -I -S /bin/bash -l walltime=10:00:00 -l select=1:ncpus=2:mem=4gb
Create a folder to download data from ENA
mkdir myname/data
Move to the data folder:
cd mynam/data