Basic Commands

On this page, you will find basic commands for working with:

Linux

In the examples, the file is named “myfile” and the directory is named “mydir.” You must replace these with YOUR file and directory names.

Command What It Does
ls Gets a list of all files and directories
cd <directory name> Changes the current directory to the directory named, e.g., cd mydir
touch <new file name> Makes a new file, e.g., touch myfile
rm <name of file> Removes (deletes) a file, e.g., rm myfile
cat <name of file> Shows the content of the file named, e.g., cat myfile
mkdir <name of directory> Makes a new directory, e.g., mkdir mydir
rmdir <name of directory> Removes (deletes) a directory, e.g., rmdir mydir
nano <name of file> Opens editor window for either an
existing file OR a new file with that name, e.g., nano myfile
vi <name of file> Opens editor window for either an
existing file OR a new file with that name, e.g., vi myfile
<command> --help Displays general help/information about the command named, e.g., ls --help
clear Clears the terminal screen
exit Exits the shell (ends session)

Switcher

Command What It Does
switcher --list Lists all available software packages
switcher --list <software name> Lists all available versions of <software name>, e.g., switcher --list mpi
switcher <software name> = <version name> Loads the named software, e.g., switcher mpi = openmpi-ib-gcc-1.10.3
man switcher Displays general help/information for Switcher

Spack

Command What It Does
spack find Lists all available software packages
spack load <software package> Loads the named software package, e.g., spack load python@3.6.3
spack unload <software package> Unloads the named software package, e.g., spack unload python@3.6.3
spack --help Displays general help/information for Spack

Modules

Command What It Does
module avail Lists all available software modules
module load <module name> Loads the named software module, e.g., module load mpi/openmpi-3.1.4-ib
module unload <module name>
Unloads the named software module, e.g., module unload mpi/openmpi-3.1.4-ib
module list Lists all the currently loaded modules
module help Displays general help/information about modules

Slurm

For more information about Slurm commands, see SchedMD Slurm Documentation.

In the examples, the job file name is “myjob,” the user name “usr1234,” and the job ID is “123456.” You must replace these with YOUR file name, user name, and job ID.

HEADER LINES

NOTE: There are no spaces around the = and : signs.

Header Line What It Does
#SBATCH --partition=<partition_name> Specifies partition, e.g., #SBATCH --partition=short or #SBATCH --partition=dggpu
#SBATCH --nodes=<n> Requests number of nodes (n), e.g.,
#SBATCH --nodes=1
#SBATCH --ntasks=<n> Requests number of processes to run, e.g.,
#SBATCH --ntasks=4
#SBATCH --gres=gpu:<n> Requests GPUs, e.g., #SBATCH --gres=gpu:1
#SBATCH --mem=<amount> Requests memory for the entire job, e.g., #SBATCH --mem=24G
#SBATCH --mem-per-cpu=<amount> Requests memory for the entire job, e.g., #SBATCH --mem-per-cpu=1G
#SBATCH --time=<dd-hh:mm:ss> Requests amount of time needed for job. Acceptable formats are: mm, mm:ss, hh:mm:ss, dd-hh, dd-hh:mm, dd-hh:mm:ss, e.g., #SBATCH --time=01:00:00
#SBATCH --job-name=<jobname> Sets job name, e.g., #SBATCH --job-name=myjob
#SBATCH --mail-user=<youremail@uvm.edu> Sets email address where status emails are sent,, e.g., #SBATCH --mail-user=usr1234@uvm.edu
#SBATCH --mail-type=<type> Requests that a status email be sent. Options include: NONE, BEGIN, END, FAIL, REQUEUE, ALL. E.g., #SBATCH --mail-type=ALL
#SBATCH --output=%x_%j.out By default, STDOUT and STDERR log files are joined and are named “slurm-<job_id>.out,” e.g., slurm-123456.out

This command sets a custom output file name by using Slurm-assigned variables:

%x = <jobname you have assigned>
%j = <job_id Slurm has assigned>

Using the command #SBATCH --output=%x_%j.out with our example job name and job ID results in an output filed named: myjob_123456.out

COMMANDS

In the examples, the job file name is “myjob,” the user name “usr1234,” and the job ID is “123456.”

Command What It Does
sbatch <file_name> Submits a job, e.g., sbatch myjob
srun <file_name> Submits an interactive job, e.g., srun myjob
scontrol show job <job_id> Detailed information about a particular job, e.g., scontrol show job 123456
scontrol update jobid=<job_id> <desired modification> Alters a queued job (nodes, processes, time, etc.), e.g., scontrol update jobid=123456 nodes=2
squeue Checks status of all jobs in scheduling queue
squeue -u <username> Checks status of all jobs belonging to the named user, e.g., squeue -u usr1234
squeue --start -j <job_id> Estimates earliest start time of a particular job, e.g., squeue --start -j 123456
squeue --start -u <username> Estimates earliest start time of all jobs belonging to the named user, e.g., squeue --start -u usr1234
scontrol hold <job_id> Holds a particular job, e.g., scontrol hold 123456
scontrol release <job_id> Releases a particular job, e.g., scontrol release 123456
scancel -u <username> Deletes/cancels all jobs belonging to the named user, e.g., scancel -u usr1234
scancel <job_id> Deletes/cancels a particular job, e.g., scancel 123456
Updated on August 5, 2020

Was this article helpful?

Related Articles

Need Support?
Can't find the answer you're looking for?
Contact Support