# Common Slurm Commands

Quick reference for the most common Slurm commands on the TAU HPC cluster.

## Submitting Jobs

<table id="bkmrk-command-description-"><thead><tr><th>Command</th><th>Description</th></tr></thead><tbody><tr><td>`sbatch job.sh`</td><td>Submit a batch job script</td></tr><tr><td>`srun --pty bash`</td><td>Start an interactive session</td></tr><tr><td>`sbatch --depend=afterok:JOBID job.sh`</td><td>Submit job after another completes</td></tr></tbody></table>

## Monitoring Jobs

<table id="bkmrk-command-description--1"><thead><tr><th>Command</th><th>Description</th></tr></thead><tbody><tr><td>`squeue -u username`</td><td>Your running and pending jobs</td></tr><tr><td>`squeue`</td><td>All jobs on the cluster</td></tr><tr><td>`scontrol show job JOBID`</td><td>Full details of a job</td></tr><tr><td>`sacct -j JOBID --format=JobID,JobName,State,MaxRSS,Elapsed`</td><td>Job accounting and memory usage</td></tr><tr><td>`sattach JOBID`</td><td>Attach to a running job's output</td></tr></tbody></table>

## Managing Jobs

<table id="bkmrk-command-description--2"><thead><tr><th>Command</th><th>Description</th></tr></thead><tbody><tr><td>`scancel JOBID`</td><td>Cancel a specific job</td></tr><tr><td>`scancel -u username`</td><td>Cancel all your jobs</td></tr></tbody></table>

## Cluster Information

<table id="bkmrk-command-description--3"><thead><tr><th>Command</th><th>Description</th></tr></thead><tbody><tr><td>`sinfo`</td><td>Partition and node status</td></tr><tr><td>`scontrol show partition PARTITION`</td><td>Partition details and limits</td></tr><tr><td>`check_my_partitions`</td><td>Your available partitions and accounts</td></tr><tr><td>`features`</td><td>Available node constraints/features</td></tr></tbody></table>

## Environment Modules

<table id="bkmrk-command-description--4"><thead><tr><th>Command</th><th>Description</th></tr></thead><tbody><tr><td>`module avail`</td><td>List all available modules</td></tr><tr><td>`module avail NAME`</td><td>Search for a specific module</td></tr><tr><td>`module spider NAME`</td><td>Detailed module info including dependencies</td></tr><tr><td>`module load NAME`</td><td>Load a module</td></tr><tr><td>`module list`</td><td>List loaded modules</td></tr><tr><td>`module unload NAME`</td><td>Unload a module</td></tr><tr><td>`module purge`</td><td>Unload all modules</td></tr></tbody></table>

## Common SBATCH Directives

<table id="bkmrk-directive-descriptio"><thead><tr><th>Directive</th><th>Description</th></tr></thead><tbody><tr><td>`#SBATCH --job-name=NAME`</td><td>Job name</td></tr><tr><td>`#SBATCH --account=ACCOUNT`</td><td>Account name</td></tr><tr><td>`#SBATCH --partition=PARTITION`</td><td>Partition/queue</td></tr><tr><td>`#SBATCH --qos=QOS`</td><td>Quality of Service</td></tr><tr><td>`#SBATCH --time=HH:MM:SS`</td><td>Max run time</td></tr><tr><td>`#SBATCH --ntasks=N`</td><td>Number of tasks</td></tr><tr><td>`#SBATCH --nodes=N`</td><td>Number of nodes</td></tr><tr><td>`#SBATCH --cpus-per-task=N`</td><td>CPU cores per task</td></tr><tr><td>`#SBATCH --mem-per-cpu=NG`</td><td>Memory per CPU</td></tr><tr><td>`#SBATCH --mem=NG`</td><td>Total memory</td></tr><tr><td>`#SBATCH --gres=gpu:N`</td><td>Number of GPUs</td></tr><tr><td>`#SBATCH --constraint=FEATURE`</td><td>Node constraint/feature</td></tr><tr><td>`#SBATCH --array=1-N`</td><td>Job array</td></tr><tr><td>`#SBATCH --output=FILE_%j.out`</td><td>Output file (%j = job ID)</td></tr><tr><td>`#SBATCH --error=FILE_%j.err`</td><td>Error file</td></tr><tr><td>`#SBATCH --mail-user=EMAIL`</td><td>Notification email</td></tr><tr><td>`#SBATCH --mail-type=END,FAIL`</td><td>When to notify</td></tr></tbody></table>