at Command
Intermediate Logging & Monitoring man(1)Schedule a one-time command to run at a specific time
👁 9 views
📅 Updated: Mar 15, 2026
SYNTAX
at [OPTION]... TIME
What Does at Do?
at schedules a command to run once at a specified time in the future. Unlike cron which runs tasks repeatedly, at runs a one-time job. It is perfect for scheduling maintenance, delayed tasks, and one-off operations.
at reads commands from standard input or a file and queues them for later execution. The atd daemon executes the jobs at the specified time.
at supports flexible time specifications: "now + 1 hour", "midnight", "noon tomorrow", "4pm Friday", and specific dates.
at reads commands from standard input or a file and queues them for later execution. The atd daemon executes the jobs at the specified time.
at supports flexible time specifications: "now + 1 hour", "midnight", "noon tomorrow", "4pm Friday", and specific dates.
Options & Flags
| Option | Description | Example |
|---|---|---|
| TIME | Schedule job at specified time | at 2:00 AM tomorrow |
| -l | List pending jobs (same as atq) | at -l |
| -d N | Delete job N (same as atrm) | at -d 5 |
| -f | Read commands from file | at -f script.sh 3:00 PM |
| -m | Send mail when job completes | at -m 5:00 PM |
Practical Examples
#1 Schedule for tonight
Schedules backup script for 11 PM tonight.
$ echo "/usr/local/bin/backup.sh" | at 11:00 PM
Output:
job 5 at 2024-01-15 23:00
#2 In one hour
Restarts nginx one hour from now.
$ echo "systemctl restart nginx" | at now + 1 hour#3 Tomorrow morning
Schedules a report for tomorrow morning using here-doc.
$ at 8:00 AM tomorrow << EOF\n/usr/local/bin/report.sh\nEOF#4 From file
Reads and schedules commands from a file.
$ at -f maintenance.sh 2:00 AM Saturday#5 List pending jobs
Shows all pending at jobs.
$ atq
Output:
5\t2024-01-15 23:00 a user
#6 Delete job
Removes pending job number 5.
$ atrm 5Tips & Best Practices
Flexible time formats: "now + 30 minutes", "midnight", "noon tomorrow", "4pm next Friday", "teatime" (4pm), "2:00 AM 01/20/2025".
Environment is preserved: at inherits the current environment (PATH, HOME, etc.) so commands work the same as if typed interactively.
atd must be running: at requires the atd daemon: sudo systemctl enable --now atd.
Frequently Asked Questions
How do I schedule a one-time task?
echo "command" | at TIME. Examples: at 3:00 PM, at now + 2 hours, at midnight tomorrow.
How do I see pending jobs?
atq (or at -l) lists all pending at jobs with their IDs and scheduled times.
How do I cancel a scheduled job?
atrm JOB_NUMBER (or at -d JOB_NUMBER). Find the number with atq.
Related Commands
More Logging & Monitoring Commands
Master Linux with Professional eBooks
Curated IT eBooks covering Linux, DevOps, Cloud, and more
Browse Books →