
scancel: Cancel a Slurm Job
scancel is your go-to command for terminating Slurm jobs from the command line. It can target a single job by ID or clear out all jobs owned by a user.
Quick start
- Cancel a single job by its ID:
scancel 123456
- Cancel all jobs for a specific user:
scancel -u alice
Tip: Slurm also supports the long form of the user option:
scancel --user alice
Common use cases
- You started a job by mistake and want to stop it quickly.
- A user left a long-running job that blocks the queue and needs manual cleanup.
- You have permission to manage a subset of jobs on a shared cluster.
Practical examples
- Cancel several specific jobs (by ID):
scancel 123456 123457 123458
- Cancel all of one user’s jobs except those in a certain partition (requires filtering or manual review, not a single flag):
scancel -u bob
- Cancel a job and ensure it prints a confirmation (exit status 0 on success):
scancel 987654 && echo Job canceled
Common pitfalls
- Mistakenly canceling the wrong job or user. Double-check the ID or username before executing.
- On some systems, you may need elevated permissions to cancel others’ jobs. If you don’t have permission, scancel will fail with an error.
- If the job already completed or is in a state that can’t be canceled, scancel will report an error or no-op depending on the situation.
Troubleshooting tips
- List current jobs to verify target:
squeue -u <your-username>
- If scancel returns a permission error, contact your cluster administrator or check your account rights.
- For batch systems with multiple partitions or farms, double-check the scope (job vs user) to avoid unintended cancellations.
Quick reference
- Cancel a single job:
scancel <job_id>
- Cancel all jobs for a user:
scancel -u <username>
orscancel --user <username>
- Cancel multiple specific jobs:
scancel <job_id1> <job_id2> ...
See Also
- What is the su Command in Linux?
- How Does the elink Command Enhance Data Cross-Referencing in NCBIs EDirect Suite?
- How to Use the apt Command for Package Management
- How to Master the Rename Command in Linux
- How to Use the less Command for Interactive File Navigation
- How to Use the ifstatus Command in OpenWRT?