Filters
How to search
  • Plain words find names, texts and examples.
  • "two words" finds the exact phrase.
  • --name or -x finds an option.
  • #word looks only inside commands.
  • @grep finds lessons and labs that use grep.
  • Filters: cat:network · in:labs · in:notes · level:rhcsa · ch:8 · root:yes. Put ! before a word to leave it out. OR between words means one of them.
  • ↑ ↓ to move · Enter to open · Esc to close · / to search

at

Run commands once at a later time (at), list (atq) or remove (atrm) those jobs, or run them when the load is low (batch).

Level
RHCSA exam
Group
Scheduling
Needs root
No
Package
at
Also called
atq, atrm, batch

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...
batch

Options 14

Most used

-f FILE
Read the commands from a file.
-t TIME
Time in the form [[CC]YY]MMDDhhmm[.ss].
-l
List jobs (same as atq).
-r, -d
Remove jobs (same as atrm).
-c JOB
Show the full script of a job.
-b
Run when the load is low (same as batch).
-q QUEUE
Use a queue (a–z; later letters = nicer).
-m
Send mail when the job is done, even without output.
-M
Never send mail.
-u USER
The user for mail (root only).
-v
Show the run time before reading the job.
-k
Keep the environment of the job unchanged.
-o FORMAT
With atq: time format.
-V
Show the version.

Examples 11

$ run as a normal user# run as root (or with sudo)

  1. 1Install and start atd

    dnf install -y at
    systemctl enable --now atd

    Without atd nothing runs.

  2. 2Plan a command

    at 23:00
    at> systemctl restart httpd
    at> <EOT>
    job 3 at Sun Oct 25 23:00:00 2026

    Ctrl+D ends the input.

  3. 3Plan with a pipe

    echo "tar -czf /tmp/home.tgz /home/lisa" | at now + 2 hours

    No typing needed; good in scripts.

  4. 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.

  5. 5Remove a job

    atrm 3

    Use the number from atq.

  6. 6Run a script file at a time

    at -f /root/maintenance.sh 02:00 tomorrow

    The script runs with sh.

  7. 7Safety net for remote firewall changes

    echo "firewall-cmd --reload" | at now + 10 minutes

    If your new rule locks you out, the reload restores the permanent rules. Remove the job when all is fine.

  8. 8Run when the system is quiet

    echo "/usr/local/bin/reindex.sh" | batch

    Starts when the load drops under 0.8.

  9. 9Plan a reboot for the night

    echo "systemctl reboot" | at 03:00

    Same idea as shutdown -r 03:00.

  10. 10Block a user from at

    echo lisa >> /etc/at.deny

    Like cron.deny.

  11. 11Check for unknown at jobs (security)

    atq; ls -l /var/spool/at/

    Attackers can hide one-time jobs here.

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).