Quick Reference Guide

From Research Computing Center Wiki
Revision as of 08:33, 13 October 2021 by Ben (talk | contribs)
Jump to navigation Jump to search

Linux

Below are the minimum Linux commands and shortcuts that you should know to do work on an HPC cluster.

Commands

Getting Help (most important)

Command Description Examples
command --help Print a commands help output to the terminal ls --help
man command Read a command's manual (press q to exit) man ls

Directories

Command Description Examples
ls List the contents of a particular directory (current dir if no path specified) ls /scratch/MyID
mkdir Make a new directory at the specified path mkdir /scratch/MyID/workdir
cd Change directory to a particular directory (personal /home dir if no path specified) cd /scratch/MyID/workdir
rmdir Remove an empty directory rmdir tmpdir

Files

Command Description Examples
nano Create or edit a file with nano (to save and exit: ctrl + x, y, enter) nano sub.sh
cat Print the contents of a file to the terminal (better for shorter files) cat slurm-42342.out
less View the contents of a file (better for longer files) less slurm-42342.out
cp Copy a file or files (cp sourcepath(s) destinationpath) cp /scratch/MyID/workdir/sub.sh /work/labgroup
rm Remove a file or files rm oldfile.txt
rm -r Remove a directory and all of its contents, recursively (starting with the last dir in the path) rm -r /home/MyID/olddir

Back to Top

Shortcuts

Shortcut Description
ctrl + l (lowercase L) Clear your terminal screen (scroll up to see previous output)
up/down arrow keys Cycle through previously entered commands
esc, . (escape, then period) Cycle through previous arguments to commands
ctrl + w Backspace typed text on the command line, one word at a time
ctrl + c Cancel typed text on the command line

Back to Top

Slurm

Below are the minimum Slurm commands that you should know to do work on an HPC cluster. The first table are default Slurm commands. The next table are GACRC pre-formatted wrapper scripts of the Slurm commands to provide more information and flexibility.

Default Slurm Commands

Command Description Examples
sbatch Submit a submission script to the cluster sbatch sub.sh
squeue Check status currently running jobs (--me for only your jobs) squeue --me
sacct -X Check status of your jobs started since midnight of current day (-X for one line per job) sacct -X
sacct -X -S yyyy-mm-dd Check status of your jobs since yyyy-mm-dd sacct -X -S 2021-10-20
sacct -j jobID Check status of a particular job sacct -j 234213
scancel jobID Cancel one of your running jobs scancel 456781
sinfo Check the status of partitions sinfo -p batch

GACRC Slurm Commands

Command Description/Slurm Equivalent Examples
interact Start an interactive job. (Same as qlogin but with more flexibility) interact -c 4 --mem 10gb --time 01:00:00
sq squeue sq --me
sacct-gacrc -X sacct sacct-gacrc -X