at Command in Linux: Schedule One-Time Tasks

By 

Updated on

7 min read

Scheduling one-time tasks with the at command in Linux

at is a command-line utility that schedules commands and scripts to run automatically at a specific time and date. Unlike crontab , which runs jobs on a recurring schedule, at executes each job only once — making it ideal for one-time tasks that need to run at an exact time.

This guide explains how to use at and its companion utilities atq, atrm, and batch to create, view, and delete scheduled jobs.

Installing at

Depending on the distribution, at may not be installed by default.

  • Ubuntu, Debian, and Derivatives

    Terminal
    sudo apt update
    sudo apt install at
  • Fedora, RHEL, and Derivatives

    Terminal
    sudo dnf install at

Once installed, make sure atd — the scheduling daemon — is running and enabled to start on boot:

Terminal
sudo systemctl enable --now atd

at Command Syntax

The syntax for the at command is:

txt
at [OPTIONS] RUNTIME
  • RUNTIME — the time (and optionally date) when the job should run.
  • -f FILE — read commands from a file instead of standard input.
  • -l — list pending jobs (same as atq).
  • -r — remove a job by number (same as atrm).
  • -q QUEUE — assign the job to a specific queue (az, AZ).
  • -m — send email even if the job produces no output.
  • -M — suppress email notification entirely.
  • -c JOBNUM — print the full contents of a queued job.

Schedule a Job

To schedule a job, run at with the desired time. After pressing Enter, you are presented with the at> prompt where you enter the commands to run:

Terminal
at 09:00
output
warning: commands will be executed using /bin/sh
at>

Enter the command to execute:

Terminal
tar -xf /home/linuxize/file.tar.gz

When you are done, press Ctrl+D to save the job and exit the prompt:

output
at> <EOT>
job 4 at Tue May  5 09:00:00 2026

at prints the job number and the scheduled execution time.

You can also pass commands using echo and a pipe:

Terminal
echo "command_to_run" | at 09:00

Or use a here document :

Terminal
at 09:00 <<END
command_to_run
END

To read commands from a script file, use the -f option:

Terminal
at 09:00 -f /home/linuxize/script.sh

View a Scheduled Job

To inspect the full contents of a queued job, use the -c option followed by the job number:

Terminal
at -c 4

This prints the environment setup and the commands that will run, which is useful for verifying a job before it executes.

Specifying the Execution Time

at accepts a wide range of time and date formats.

Time — use HH:MM or HHMM in 24-hour format, or add am/pm for 12-hour format. You can also use the keywords now, midnight, noon, or teatime (16:00). If the specified time has already passed today, the job is scheduled for the same time tomorrow.

Date — specify a date using the month name followed by the day and optional year, or use keywords like today, tomorrow, or a weekday name. Numeric formats such as MMDDYY, MM/DD/YY, DD.MM.YY, and YYYY-MM-DD are also accepted.

Increment — use now + count time-unit where time-unit is minutes, hours, days, or weeks.

Here are some examples:

Terminal
# Run at 1 pm two days from now
at 1pm + 2 days
Terminal
# Run one hour from now
at now + 1 hour
Terminal
# Run next Sunday, 10 minutes later than the current time
at sunday + 10 minutes
Terminal
# Run at 12:30 on a specific date
at 12:30 102126

You can also specify a precise time using the -t option in [[CC]YY]MMDDhhmm[.ss] format:

Terminal
at -t 202605111321

batch Command

batch schedules jobs and runs them when the system load permits. By default, jobs execute when the system load average drops below 1.5. If the load is higher, jobs wait in the queue.

batch is equivalent to at -b. To create a batch job:

Terminal
echo "command_to_run" | batch

Specifying a Queue

Jobs created with at are placed in queue a by default. Jobs created with batch use queue b. Queues are named from a to z and A to Z. Queues with lower letters have lower niceness values, giving them higher CPU priority over queues with higher letters.

To assign a job to a specific queue, use the -q option:

Terminal
at monday +2 hours -q L

List Pending Jobs

To list your pending jobs, run atq or at -l:

Terminal
atq
output
9    Tue May  5 12:22:00 2026 a linuxize
12   Wed Oct 21 12:30:00 2026 a linuxize
4    Tue May  5 09:00:00 2026 a linuxize

Each line shows the job number, scheduled date and time, queue, and username. When run as root, atq lists all users’ jobs.

Remove a Pending Job

To remove a pending job, run atrm or at -r followed by the job number:

Terminal
atrm 9

Restrict User Access

The /etc/at.deny and /etc/at.allow files control which users can schedule jobs with at or batch.

By default, only /etc/at.deny exists and is empty, meaning all users can use at. To deny a specific user, add their username to /etc/at.deny.

If /etc/at.allow exists, only users listed in that file can use at. If neither file exists, only root can schedule jobs.

Quick Reference

TaskCommand
Schedule a job interactivelyat HH:MM
Schedule from a script fileat 09:00 -f script.sh
Run one hour from nowat now +1 hour
Run tomorrow at noonat noon tomorrow
Suppress email outputat 09:00 -M
View job contentsat -c JOBNUM
List pending jobsatq
Remove a jobatrm JOBNUM
Schedule when load allowsecho "cmd" | batch
Assign to a queueat 09:00 -q L

Troubleshooting

at command not found
Install the at package with sudo apt install at (Debian/Ubuntu) or sudo dnf install at (Fedora/RHEL). Then enable the daemon with sudo systemctl enable --now atd.

Job does not run at the scheduled time
Check that atd is running: sudo systemctl status atd. If it is stopped, start it with sudo systemctl start atd.

You do not have permission to use at
Your username is listed in /etc/at.deny or is not listed in /etc/at.allow. Ask your system administrator to update the access files.

Job ran but produced no email
By default, at sends output via local mail. If no mail daemon is configured, output is silently dropped. Use -m to force an email even with no output, or redirect output to a file in the job command: command >> /tmp/job.log 2>&1.

Job ran with wrong environment
at runs jobs in a minimal shell environment. Verify paths and variables are set explicitly in your script, or source your profile at the start of the job.

FAQ

What is the difference between at and crontab?
crontab schedules recurring jobs that run on a fixed schedule (every hour, every day). at schedules a job to run exactly once at a specified time. Use at for one-time tasks and crontab for recurring ones.

How do I check if a job ran?
Use atq to see pending jobs. If a job no longer appears in atq, it has already run or was removed. Check the system mail or any output files you redirected to for the results.

Can I schedule multiple commands in one at job?
Yes. Enter each command on a separate line at the at> prompt, or use a script file with -f. All commands in a job run sequentially in the same shell session.

What happens if the system is off when a job is scheduled?
at does not have built-in catch-up support. If the system is powered off at the scheduled time, the job is skipped entirely. Use anacron for tasks that must run even after a missed execution window.

Does at support running jobs as a different user?
Not directly. To run a job as another user, use sudo -u username at HH:MM if you have the necessary privileges.

Conclusion

The at command schedules one-time tasks to run at a specific time without recurring. Use atq to list pending jobs, atrm to remove them, and at -c to inspect their contents before they run. For recurring tasks, use crontab instead.

If you have any questions, feel free to leave a comment below.

Linuxize Weekly Newsletter

A quick weekly roundup of new tutorials, news, and tips.

About the authors

Dejan Panovski

Dejan Panovski

Dejan Panovski is the founder of Linuxize, an RHCSA-certified Linux system administrator and DevOps engineer based in Skopje, Macedonia. Author of 800+ Linux tutorials with 20+ years of experience turning complex Linux tasks into clear, reliable guides.

View author page