Basic UNIX commands

After logging in to the HPC via SSH, you can use the UNIX command line to navigate through directories, create files, launch scripts, and much more. If you are not familiar with UNIX commands, some basic commands can be found in this section.

After logging in, you arrive in your home directory. Type pwd and press Enter to print out the current directory (pwd = print working directory).

Directories can be changed using the cd (change directory) command. You can use the symbolic link cd ~ to navigate to your home directory, and cd .. takes you one directory upwards. Contents of a directory can be displayed by using the ls (list) command (use ls -l or ls -ltrh for extra information). Hint: when typing the name of a file or directory, you can use the <TAB> button to autocomplete!

On the HPC, you can make use of preset variables to navigate to specific directories. For instance, the $VSC_HOME variable points towards your home directory, the $VSC_DATA towards your data directory, the $VSC_DATA_VO to the data drive of your virtual organization (if you have one), and $VSC_DATA_VO_USER to your personal directory within that data drive. To display the contents of a variable, use echo.

By default, the alphafold directory does not yet exist on your data drive. Making directories can be done using mkdir. Empty directories can be removed using rmdir, non-empty directories can be removed using rm -r. This is a special use of the regular removal command for regular files, rm. Be very careful when removing files (especially with the -r) option, as there is no undo button.

File contents can be displayed using cat (just print everything out) or less (scroll through the file – press Q to quit). File contents can be edited with multiple tools, for example nano. Within the nano program, press CTRL+O followed by Enter to save a file. Press CTRL+X to exit the program. If there are any unsaved changes, nano will prompt you to save (type Y and Enter) or discard (type N and Enter) them.

Copying files is done with cp, moving and/or renaming files is done with mv. To copy entire directories, use copy -r.

Finally, the following commands are essential to run jobs on the HPC:

  • module swap cluster/<name>: changes to which cluster jobs are submitted
  • module list or ml: gives a list of loaded modules, including the currently selected cluster
  • qsub <job filename>: submits a job script
  • qstat: displays queued, running and recently completed (or crashed) jobs on the loaded cluster
  • qdel <job id>: stops a running job or removes it from the queue

If all of this is too much to digest at once, at the end of this lesson is a basic workflow example of how to run AlphaFold with all steps: logging in, navigating and copying files to the right directories, setting up the AlphaFold script, running it, and copying outputs back to your personal computer.