at Command in Linux with Examples

at command is a command-line utility that is used to schedule a command to be executed at a particular time in the future. Jobs created with at command are executed only once. The at command can be used to execute any program or mail at any time in the future. It executes commands at a particular time and accepts times of the form HH:MM to run a job at a specific time of day. The following expression like noon, midnight, teatime, tomorrow, next week, next Monday, etc. could be used with at command to schedule a job.

Syntax:

at [OPTION...] runtime

Installation of at command

For Ubuntu/Debian :

sudo apt-get update
sudo apt-get install at

For CentOS/Fedora :

sudo yum install at

Working with at command

1. Command to list the user’s pending jobs:



at -l

or

atq

list_pending_jobs_at_command
2. Schedule a job for the coming Monday at a time twenty minutes later than the current time:

at Monday +20 minutes

3. Schedule a job to run at 1:45 Aug 12 2020:

at 1:45 081220

4. Schedule a job to run at 3pm four days from now:

at 3pm + 4 days

5. Schedule a job to shutdown the system at 4:30 today:

# echo "shutdown -h now" | at -m 4:30

6. Schedule a job to run five hour from now:

at now +5 hours

schedule-jobs-at-command
7. at -r or atrm command is used to deletes job , here used to deletes job 11 .

 at -r 11

or

atrm 11

My Personal Notes arrow_drop_up

Check out this Author's contributed articles.

If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.

Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.