The atrm command in Linux is used to remove or delete at jobs from the queue. When you schedule tasks using the at command, they are added to a queue for later execution. The atrm command allows you to remove specific at jobs from the queue, preventing them from being executed at their scheduled time.
The basic syntax of the atrm command is as follows:
atrm <job_id>...Here’s a table explaining the main parameter of the atrm command:
| Parameter | Description |
|---|---|
| job_id | Specifies the job ID(s) of the at jobs to be removed. You can specify multiple job IDs. |
Now, let’s see some examples of how to use the atrm command:
- Remove a single
atjob from the queue:
atrm 1This command will remove the at job with ID 1 from the queue.
- Remove multiple
atjobs from the queue:
atrm 1 3 5This command will remove the at jobs with IDs 1, 3, and 5 from the queue.
- Remove all
atjobs from the queue:
atrm $(atq | awk '{print $1}')This command will remove all at jobs from the queue. The atq command lists all pending at jobs, and awk is used to extract the job IDs, which are then passed to atrm for removal.
Keep in mind that once you remove an at job from the queue using atrm, it cannot be undone, and the scheduled task will not be executed at its specified time. Be careful when using atrm to avoid accidentally deleting important tasks.