Session and utilities

The at command

Schedules a command to run once at a specific time, even after you log out. The atd daemon runs it, so atd has to be active.

Syntax

at [-f archivo] [-m] [-q cola] horaTry it in the terminal →

Most useful options

-f <archivo>Reads the commands from a file instead of asking for them at the keyboard
-mSends mail when the job finishes, even if it has no output
-lLists pending jobs, the same as atq
-d <número>Deletes a pending job, the same as atrm
-c <número>Shows the exact script that job will run
-t <AAAAMMDDhhmm>Date and time in fixed format, useful from a script

Copy-ready examples

$ echo 'tar -czf /tmp/copia.tgz ~/Documentos' | at 03:00schedules a backup for 3 a.m., with the command piped in.

Example output

job 12 at Wed Nov  4 03:00:00 2026
$ at now + 10 minutesopens an interactive prompt: you type the commands, press Ctrl+D and they are scheduled.
$ at -f limpieza.sh 23:30runs the limpieza.sh script tonight at 23:30.

Example output

job 13 at Tue Nov  3 23:30:00 2026
$ atqlists pending jobs: number, date, queue and user.

Example output

12	Wed Nov  4 03:00:00 2026 a miguel
13	Tue Nov  3 23:30:00 2026 a miguel
$ atrm 12cancels job 12, which will not run.
$ at -c 13shows the script job 13 will run, before you trust it.

You can try them in the browser terminal: it does not touch your computer.

Common errors

MessageCauseFix
Garbled timeat does not understand the time: you wrote a format it does not recognize, such as 25:00.Use clear formats: 17:30, now + 10 minutes, midnight, teatime or tomorrow.

Typical mistakes

  • at does not repeat: a job runs once. For recurring tasks use crontab.
  • If atd is not running, at accepts the job but nothing runs. Check with systemctl status atd.
  • The command runs with the environment and directory you had when you scheduled it.

Differences from similar commands

  • crontab: repeats tasks on fixed schedules. at runs them only once.
  • sleep: pauses a script for a few seconds, while the script keeps waiting. at schedules something for later and leaves nothing open.
  • nohup: starts a process now, immune to logout. at starts it later, at a fixed time.

Security

at runs commands without you in front of the machine, with your permissions. A forgotten job can run weeks later. Check atq now and then, and limit who can use it with /etc/at.allow or /etc/at.deny.

Related commands

FAQ

How do I see what I scheduled?

atq lists the pending jobs. at -c NUMBER shows the exact script that will run.

How do I cancel a job?

With atrm NUMBER. Check the number with atq first.

Why did my job do nothing?

Usually one of these: atd is not running, the output was not saved anywhere, or the command uses relative paths that do not exist when it runs.

Learn to actually use it

The basic Linux course takes you from zero to console fluency with 24 self-grading lessons.

Start the free course