Ubuntu — Schedule One-Time Commands with at
cron handles recurring tasks. at handles one-time execution — run a command or script once at a specific future time. Useful for a planned reboot, a delayed script run, or anything you need scheduled exactly once.
Pre-requisites
- Ubuntu 22.04+ (or any Debian-based system)
sudoaccess
Install
Start and enable the atd daemon:
Verify:
Schedule a Job
at opens an interactive prompt. Enter the command, then press Ctrl+D to save:
at now + 10 hours
warning: commands will be executed using /bin/sh
at> reboot
at> <EOT>
job 1 at Mon May 26 08:00:00 2026
Commands requiring sudo
Prefix the command with sudo inside the at prompt as normal — the job runs under the current user's permissions.
Time formats
now + 10 minutes
now + 2 hours
now + 3 days
now + 1 week
tomorrow
5:00 AM tomorrow
10:00 PM
15:30
10:00 AM next week
next friday
01/26/2026 08:00
Read Commands from a File
Each line in commands.txt is a separate command, executed in sequence.
List Scheduled Jobs
at -l is an alias for the same command.
Output shows job number, scheduled time, queue, and owner:
Inspect a Job
Shows the full environment and commands that will be executed.
Remove a Job
Remove all pending jobs:
Common Issues
| Symptom | Cause | Fix |
|---|---|---|
bash: at: command not found |
Package not installed | sudo apt install at |
| Job does not run | atd not running |
sudo systemctl start atd |
| Job runs but produces no output | Output goes to local mail by default | Redirect output: mycommand > /tmp/out.log 2>&1 |