atrm

process managementlinux
The atrm command is one of the most frequently used commands in Linux/Unix-like operating systems. atrm The atrm command removes jobs that were previously scheduled with the at command. It deletes jobs from the queue of tasks to be run at a later time.

Quick Reference

Command Name:

atrm

Category:

process management

Platform:

linux

Basic Usage:

atrm [options] [arguments]

Common Use Cases

  • 1

    Job cancellation

    Remove scheduled jobs from the queue

  • 2

    Queue management

    Clean up unwanted or obsolete scheduled tasks

  • 3

    System maintenance

    Remove jobs that are no longer needed

  • 4

    Error recovery

    Remove failed or problematic scheduled jobs

Syntax

atrm [-V] job [job...]

Options

Option Description
-V Display version information
job The job number(s) to be removed

Examples

How to Use These Examples

The examples below show common ways to use the atrm command. Try them in your terminal to see the results. You can copy any example by clicking on the code block.

Basic Examples:

Remove a single job
atrm 23
Remove multiple jobs at once
atrm 15 16 17
Check the job queue first, then remove a job
atq
atrm 42

Advanced Examples:

Remove all jobs in a script
for job in $(atq | cut -f1); do
atrm $job done
Remove only jobs scheduled for a specific date
for job in $(atq | grep "2023-08-15" | cut -f1); do
atrm $job done
Verify job removal with verbose output
job_id=25
atrm $job_id && echo "Job $job_id removed successfully"
Remove jobs as part of a cleanup process
atq > /tmp/job_list.txt
cat /tmp/job_list.txt | cut -f1 | xargs atrm

Try It Yourself

Practice makes perfect! The best way to learn is by trying these examples on your own system with real files.

Understanding Syntax

Pay attention to the syntax coloring: commands, options, and file paths are highlighted differently.

Notes

Usage Information:

The atrm command is used to remove scheduled jobs before they execute. Here are some key points to understand:

  • You need to know the job number to remove a job. Use the atq command to view all pending jobs and their job numbers.
  • atrm is equivalent to the command at -d job_number
  • You can specify multiple job numbers on a single command line to remove several jobs at once.
  • By default, users can only remove their own jobs.
  • System administrators (root) can remove any user's jobs.
  • The command will silently ignore job numbers that don't exist.
  • No confirmation is requested before removing jobs, so use with caution.

Security Considerations:

  • Access to the at facility (including atrm) is controlled by the files /etc/at.allow and /etc/at.deny
  • If /etc/at.allow exists, only users listed in it can use at, atq, and atrm commands.
  • If /etc/at.allow doesn't exist but /etc/at.deny does, all users not listed in at.deny can use the commands.
  • If neither file exists, typically only the superuser can use these commands.
  • An empty /etc/at.deny file allows all users to use the at command suite, which is common on many systems.

Tips and Tricks:

  • Always run atq first to check the job numbers before using atrm.
  • To remove all of your scheduled jobs, you can use a loop or the xargs command.
  • If you remove a job that is currently running, it will continue to execute - atrm only removes jobs from the queue.
  • There is no built-in way to "undo" an atrm command, so be certain before removing jobs.
  • In scripts, you might want to check the exit status of atrm to verify successful removal.
  • The at daemon (atd) must be running for the at command suite to work properly.

Common Use Cases

Job cancellation

Remove scheduled jobs from the queue

Queue management

Clean up unwanted or obsolete scheduled tasks

System maintenance

Remove jobs that are no longer needed

Error recovery

Remove failed or problematic scheduled jobs

Scheduling cleanup

Maintain a clean job queue by removing old entries

Related Commands

These commands are frequently used alongside atrm or serve similar purposes:

Use Cases

1

Job cancellation

Remove scheduled jobs from the queue

2

Queue management

Clean up unwanted or obsolete scheduled tasks

3

System maintenance

Remove jobs that are no longer needed

4

Error recovery

Remove failed or problematic scheduled jobs

5

Scheduling cleanup

Maintain a clean job queue by removing old entries

Learn By Doing

The best way to learn Linux commands is by practicing. Try out these examples in your terminal to build muscle memory and understand how the atrm command works in different scenarios.

$ atrm
View All Commands