Introduction to HPC

From Linux command line basics to running jobs with SLURM

Joffrey Wallaart

DIAM

Dennis Palagin

DHPC

February 2026

Course goals

Using the BASH command line interpreter, you can:

  • Work with files and make perform minor edits
  • Differentiate between a local and global environment
  • Interact with, and transfer files to remote systems
  • Create and run scripts on DelftBlue

Good News!

You’re already using linux

What should be running Linux?

Your computer!

https://cli101.cse.tudelft.nl/slides.html

The command prompt

The DelftBlue command prompt

Your first command

pwd

“Present Working Directory”

This command shows your current location in the filesystem.

Basic Navigation

The list command shows the contents of the current directory.

ls

To move into a directory use Change Directory

cd Documents

Pro tip: use the Tab key for autocompletion.

Filesystem shortcuts

Filesystem shortcuts
Shortcut Description
~ or $HOME Your home directory
/ The root directory
. The current directory
.. One directory up

Exercise - Navigation

  • Try to navigate the filestystem using cd and ls.
  • Don’t forget Tab for autocompletion.
  • In navigation, try to find a file named the_chaos.txt.
  • Try to figure out what cd - does.

Exercise - Environment variables

You’ve seen the $HOME variable. You can ‘print’ this using the echo command:

echo $HOME
  • Try $USER, $RANDOM, $SECONDS.
  • You can see a list of all variables with the command env.
  • You can set or change a variable with the syntax:
export MY_SECRET="I_<3_Penguins" # No spaces around the assignment operator.
  • Set your own variable.
  • Change the variable PS1. What happened?
  • Start a new shell/terminal session.
  • In the new shell, try to reference the variable you came up with yourself.

Options

The ls command, but with an option to make it behave differently.

ls -l

Options can be combined and often written in full.

ls --all --recursive

How does --all change the behaviour of ls?

Arguments

You can also pass an argument to a command.

This shows the contents of the Documents folder:

ls ~/Documents

You’ve been using arguments before:

cd Documents

Getting help

Almost all commands have a help option that will show you the proper syntax and the most common options:

ls --help

for more in-depth information you can also consult the manual:

man ls

What would you call the ls part of this command?

Exercise - getting help

Construct the command to list all file in the ~/Documents folder, sorted by file size, smallest first, using the long list format.

Hidden (.dot) files

Files and folders that start with a . are hidden.

Very often they contain settings (like ~/.bashrc, ~/.profiles or ~/.config/) or locally installed software (for example in ~/.local/).

You normally don’t interact with them and they are best left alone if you’re not sure what you’re doing.

Exploring file contents

cat Simply ‘print’ file contents to the terminal.
Good for use in scripts, or small files.
less More options including search.
man uses less to display the command manuals.
cat filename
less filename

Exercise - explore

  • In navigation, find sub_gmf.sh again. It is located in the same folder as the chaos.txt.
  • Use less to open this file.
  • Use search (/) to find SBATCH.
  • Use the n and N keys. What do these do?

File operations

Copy:

cp source_file target

Move or rename:

mv source_file target

Create a directory:

mkdir directory_name

Deleting files:

rm file_name

Deleting directories

To delete a directory you simply add the --recursive option, or -r / -R

rm --recursive directory_name

To avoid being asked if you want to delete every single file, you can add --force, or -f.

rm -rf directory_name

Exercise - file operations

  • Play around with copying and deleting files in the ~/Music folder
  • Rename all files with spaces in the filename
  • Create a classical_music subfolder and copy some files to it
  • Then delete the folder
  • Finally, get rid of the whole music folder with rm -rf!

Editing files

The Vim logo

Link

Vim commands

from normal mode

:w Save / (W)rite to disk
:q Quit
:wq Write and quit
:q! Force quit, without saving
i Go to insert mode
u Undo
Esc Go to normal mode
/ Search
:set number display line numbers

Exercise - Vim

  • Run fixme.py in the ~/exercises/vim folder
  • Bugfix the Python code using vim
cd $HOME/exercises/vim
./fixme
vim fixme.py

\(\tan(\pi/2) \neq 16331239353195370?\)

Enroll in wi4260tu to learn more about computational hazards in scientific programming!

Bonus Exercise - Vim

Vim is a very powerful editor. There is a small piece of software that will help you on your path to proficiency. In your terminal, run:

vimtutor

and follow along.

Redirecting output

Redirect output to a file:

./fixme.py > output.txt

Appending output to a file:

./fixme.py >> output.txt

Redirecting output to the stdin of another command.

./fixme.py | less

Exercise - Redirects

  • Go to ~/Exercises/redirects
  • Use cat to concatenate the two avocado files and redirect to a new file.
  • Then, use grep with that file to find all the entries from Albany.
  • Pipe those to wc to find out how many entries there are.
  • Remember to use --help or man for the correct syntax.

Installing packages in your $HOME

For this example, we will use a language specific package manager many of you will be somewhat familiar with. Python’s pip will notice you are not a sysadmin and will default to installing packages in the .local folder in your $HOME.

Proceed with installing the ase Python package, as we will need this in the next section.

pip install ase

Exercise - installing packages

  • Can you find the ase libraries you just installed on your system?

Permissions

File permissions allow you to control who has what kind of access to your files. To control thos you have to set mode bits.

In a nutshell, there are three levels of ownership:

  • user
  • group
  • other

Remember u, g and o. There are also three types of permissions:

  • read
  • write
  • execute

Remember r, w, and x.

Set mode bits

Remember u, g, o (and a for all) and r, w, x. The command to change the mode bits is called change mode or chmod.

chmod u+x filename
chmod go-wx filename
chmod a+rwx filename

Do you think the last one is smart on a multi-user computer like DelftBlue?

Exercise - Permissions

  • Go to ~/Exercises/permissions
  • Try to make gen_mol_folders.py executable and run it directly using ./gen_mol_folders.py

Remote access

The SSH logo

Connect to DelftBlue

Try to log in to DelftBlue using your netid:

ssh -l <netid> login.delftblue.tudelft.nl

Feels inefficient? Fortunately there is a shorthand:

ssh <netid>@login.delftblue.tudelft.nl

Configure ssh

When using ssh for the first time, a new folder is created in your $HOME: .ssh. Inside this folder we can use vim to create a file named config:

Host delftblue
    HostName login.delftblue.tudelft.nl
    User <netid>

With this file in place you can connect to DelftBlue much easier:

ssh delftblue

This now works for all programs that use ssh under the hood.

Transfering files

To transfer files to a remote system we use secure copy

scp sources hostname:target_directory

Exercise - File Transfer

  • Copy the exercises/ssh/delftblue_exercises folder (with its contents) to your home directory on DelftBlue.

DelftBlue - follow along