Linux basics#
A terminal is the standard way to interact with a supercomputer. It is worth learning the basics and getting comfortable with the “black box”, to make efficient use of the resources.
Login to the Roihu web interface, and start a login shell.
Check which directory you are in (type the command and hit
Enter):
pwd
Check the contents of the directory:
ls -l
Change the to a another directory:
cd /scratch/project_2020458/students
pwd
Make a new directory with your username:
mkdir $USER
ls -l
Go to the new directory.
cd $USER
Auto complete
If you just type cd and the first letter of the folder name, then hit the tab key, the terminal completes the name. Handy!
Download a file into this new folder.
wget https://raw.githubusercontent.com/csc-training/csc-env-eff/master/part-1/prerequisites/my-first-file.txt
ls -l
Check the contents of the file:
less my-first-file.txt
# To exit the less, hit `q`.
Make a copy of this file:
cp my-first-file.txt $USER-second-file.txt
ls -l
less $USER-second-file.txt
To move or rename a file:
mv $USER-second-file.txt $USER-third-file.txt
ls -l
less $USER-third-file.txt
Remove all files and folders created above
cd ..
rm -r $USER
ls -l
Re-executing commands from history
If you remember a part of a command that you have used recently you can search for it with the command history | grep string. This will show all your used commands that have included the string string (replace this with the pattern you are searching for).