What it does
at TIME reads commands from the keyboard (end with Ctrl+D) or from a pipe, and the atd service runs them once at that time — with your user, your current folder and your environment.
Times can be clock times (16:30, 4pm, midnight), relative (now + 2 hours) or with a date (09:00 2026-12-31, noon tomorrow). Access is controlled by /etc/at.allow and /etc/at.deny.
How to write it
at [-V] [-q QUEUE] [-f FILE] [-u USER] [-mMkv] TIME
at [-t [[CC]YY]MMDDhhmm[.ss]]
at -c JOB...
atq [-q QUEUE] [-o FORMAT]
atrm JOB...
batchOptions 14
Most used
Nothing matches this filter.
Examples 11
$ run as a normal user# run as root (or with sudo)
1Install and start atd
Without atd nothing runs.
2Plan a command
at 23:00 at> systemctl restart httpd at> <EOT> job 3 at Sun Oct 25 23:00:00 2026Ctrl+D ends the input.
3Plan with a pipe
echo "tar -czf /tmp/home.tgz /home/lisa" | at now + 2 hoursNo typing needed; good in scripts.
4List and inspect jobs
atq 3 Sun Oct 25 23:00:00 2026 a root at -c 3 | tail -3-c shows the environment and the commands.
5Remove a job
atrm 3Use the number from atq.
6Run a script file at a time
at -f /root/maintenance.sh 02:00 tomorrowThe script runs with sh.
7Safety net for remote firewall changes
echo "firewall-cmd --reload" | at now + 10 minutesIf your new rule locks you out, the reload restores the permanent rules. Remove the job when all is fine.
8Run when the system is quiet
echo "/usr/local/bin/reindex.sh" | batchStarts when the load drops under 0.8.
9Plan a reboot for the night
echo "systemctl reboot" | at 03:00Same idea as
shutdown -r 03:00.10Block a user from at
echo lisa >> /etc/at.denyLike cron.deny.
11Check for unknown at jobs (security)
atq; ls -l /var/spool/at/Attackers can hide one-time jobs here.
Nothing matches this filter.
Watch out
- at uses
sh, not bash. Avoid bash-only syntax. - Output is sent by local mail; redirect it to a file if you need it.
Files
/var/spool/at/- The queued jobs.
/etc/at.allow, /etc/at.deny- Who may use at.
Exit codes
0 :: Done. 1 :: Error (bad time, not allowed, atd problem).