System managementIntermediate19 min read

What Does at Mean?

Reviewed byJohnson Ajibi· Senior Network & Security Engineer · MSc IT Security

This page mentions older exam versions. See the Current Exam Context and Legacy Exam Context sections below for the updated mapping.

On This Page

Quick Definition

The 'at' command lets you schedule a command or script to run once at a specific time in the future. It is commonly used in system administration for tasks like running a backup at midnight or sending a notification at a certain hour. Unlike cron, which runs repeatedly, 'at' is for one-time jobs.

Commonly Confused With

atvscron

Cron schedules tasks that repeat on a regular schedule (e.g., every day at 2 AM, every Monday). 'at' schedules a task that runs only once. Cron uses crontab files, while 'at' uses a simple command-line interface. If you need a task to run just one time in the future, use 'at'. If you need it to run every day, use cron.

Running a backup every day at 3 AM? Use cron. Running a one-time script to fix a database at midnight tonight? Use at.

atvsbatch

Both 'at' and 'batch' are part of the at package, but 'batch' runs a job when the system load average drops below a certain threshold (usually 0.8). 'at' runs at a fixed time. 'batch' is for non-urgent tasks that should not compete with interactive users, while 'at' is for time-specific tasks.

Running a heavy data analysis that can wait until the server is quiet? Use batch. Running a script at exactly 8:00 AM? Use at.

atvssystemd timer

Systemd timers are a modern replacement for cron and 'at' in systems using systemd. They are more powerful and provide logging, dependencies, and integration with systemd services. 'at' is simpler, older, and targeted at one-time jobs. For basic one-time scheduling on a legacy system, 'at' is fine; on modern systems, a transient systemd timer might be preferred.

Scheduling a reboot after a kernel update next Tuesday? A systemd timer can handle it with better reporting, but 'at' is quicker for a one-off task on an older server.

atvsatrun (macOS)

On macOS, 'atrun' is a launchd-based daemon that runs 'at' jobs. The concept is the same, but the implementation differs from the Linux 'atd'. MacOS often has 'atrun' disabled by default, whereas Linux 'atd' is usually active.

If you schedule an 'at' job on macOS and it doesn't run, you might need to enable 'atrun' with 'sudo launchctl load -w /System/Library/LaunchDaemons/com.apple.atrun.plist'.

Must Know for Exams

The 'at' command is a common topic in Linux certification exams, including the CompTIA Linux+ (XK0-005), the Red Hat Certified System Administrator (RHCSA), and the Linux Professional Institute (LPI) exams, such as LPIC-1. In these exams, the objectives specifically mention job scheduling, including cron and 'at'. For example, in CompTIA Linux+ objective 4.2, candidates must “schedule jobs using cron and at,” and in RHCSA, managing scheduled tasks is a core skill.

In exam questions, you might be asked to schedule a one-time job to run at a specific time, list pending 'at' jobs with 'atq', or remove a job using 'atrm'. Multiple-choice questions often test your knowledge of syntax: for instance, which command schedules a job for 3:00 PM? Or, what does the 'm' option do? You may encounter drag-and-drop or fill-in-the-blank questions where you must complete the correct 'at' command line.

The 'batch' command is also sometimes tested, especially its behavior of running jobs only when the system load average is below 0.8. Knowing the difference between 'at' and 'batch' is a common exam point. Another exam trap involves access control: questions may ask which file restricts 'at' usage, or what happens if both at.allow and at.deny are missing.

Performance-based questions (PBQs) might ask you to schedule a job using 'at' and then verify it appears in the queue. In the lab environment, you need to be comfortable running 'at' interactively or piping commands into it. Because the command syntax is straightforward, examiners often use 'at' as a quick way to test your ability to schedule tasks under time pressure. Studying 'at' thoroughly can earn easy points in these exams.

Simple Meaning

Think of the 'at' command as setting a reminder on your phone, but for your computer. You tell the computer, “At 3 PM, run this program,” and it waits in the background until that time arrives, then executes the task exactly once. For example, imagine you want to download a large file after everyone leaves the office so it doesn’t slow down the network during the day. You could use 'at' to start the download at 6 PM. The computer checks its internal clock constantly, and when 6 PM comes, it triggers the download command you saved.

In everyday life, it’s like putting a sticky note on your fridge that says “Take out the trash at 8 PM.” You don’t do it right now; you trust yourself to check the note later. The 'at' command works the same way-you write the instruction now, and the system executes it later without you needing to be present. This is very different from cron, which repeats a task daily or weekly. With 'at', once the task runs, the schedule is removed.

System administrators use 'at' for one-off maintenance tasks, like rebooting a server after an update when no one is using it, or sending a test email at a specific time. It is simple, reliable, and built into almost every Linux distribution. Understanding 'at' helps you manage time-based operations without needing a full scripting background.

Full Technical Definition

The 'at' command is a Unix/Linux utility that reads commands from standard input or a specified file and schedules them for execution at a later time. It is part of the 'at' package, which also includes related commands like 'atq' (to list pending jobs), 'atrm' (to remove jobs), and 'batch' (which runs jobs when system load permits). The scheduling is handled by the 'atd' daemon, which runs in the background and checks the job queue every 60 seconds by default.

When a user runs 'at', the command is stored in a spool directory, typically /var/spool/at or /var/spool/cron/atjobs. Each job is saved as a file with a unique identifier, including the exact execution time, environment variables, and the command itself. The 'atd' daemon reads these files, compares the scheduled time with the system clock, and forks a child process to execute the command when the time matches.

Time specifications in 'at' are very flexible. You can use absolute times like “3:00 PM” or “14:30”, relative times like “now + 1 hour” or “now + 5 minutes”, special keywords like “noon”, “midnight”, or “teatime” (4:00 PM), and date references like “Wednesday” or “December 25”. The command also supports a 'm' option to send mail to the user after the job completes, even if there is no output.

Access control for 'at' is managed through the /etc/at.allow and /etc/at.deny files. If at.allow exists, only users listed in it can use 'at'. If at.allow does not exist but at.deny does, all users except those listed can use 'at'. If neither file exists, only the superuser (root) can use 'at' on some systems. This security mechanism prevents unauthorized users from scheduling tasks that could consume resources or compromise the system.

The 'at' command is POSIX-compliant and is available on almost all Unix-like operating systems, including Linux, macOS, and BSD. It is particularly useful for automation in scripts, system administration, and testing because it requires no crontab editing and is easy to use from the command line. One important technical detail is that 'at' captures the environment variables at the time of scheduling, not at execution time, so changes to the environment after scheduling do not affect the job. Jobs run with the same user ID and permissions as the scheduler, which is critical for security and file access.

Real-Life Example

Imagine you are baking a cake for a party that starts at 5 PM, but you have to leave the house at 2 PM to pick up supplies. You don’t want the cake to sit out too early or be baked too late. So, before you leave, you set a timer on your oven to start baking at 3 PM. The oven waits quietly until 3 PM, then turns on and bakes the cake automatically. When you come back at 4:30 PM, the cake is ready and waiting.

In the IT world, the 'at' command is that oven timer. You write a command like “shutdown -h now” to turn off a server, but you don’t want it to happen until 2 AM when no one is working. You use 'at 2:00 AM' and then enter the shutdown command. The server keeps running normally until 2 AM, then it gracefully shuts down. Just like you don’t have to watch the oven, the administrator doesn’t have to stay awake to trigger the shutdown.

This analogy also works for a slow task. Suppose you need to run a heavy database report that takes 30 minutes and slows down the website. You could run it at 3 AM using 'at', so users are not affected. The computer is like the oven-it does the work when conditions are best, without needing you to manually start it at a inconvenient hour.

Why This Term Matters

The 'at' command matters because it gives system administrators a simple, reliable way to schedule one-time tasks without editing crontab files or writing complex scripts. In real IT operations, you often need to perform maintenance at specific times-like patching a server after hours, restarting a service during a maintenance window, or sending a test email at a precise moment. Using 'at' saves time and reduces human error because you don’t have to remember to run the command at the right time.

Another reason it matters is that 'at' integrates well with shell scripts and other automation tools. For example, you can have a monitoring script that detects a failing disk and uses 'at' to schedule a backup immediately or during the next low-traffic period. This dynamic scheduling is harder to achieve with cron, which requires edited files and knows nothing about the current system state.

'at' also supports the 'batch' command, which runs jobs when the system load average drops below a specified level. This is extremely valuable for large data processing tasks that should not interfere with user performance. Professionals who understand 'at' can automate their workflows more effectively, ensure tasks happen at the right time, and avoid the overhead of manual intervention. It is a small but powerful tool that appears in many system administration exam objectives and real-world job scenarios.

How It Appears in Exam Questions

In IT certification exams, 'at' questions appear in several patterns. The most common is a direct syntax question: “Which command schedules the command 'backup.sh' to run at 2:00 AM?” The correct answer might be “echo "backup.sh" | at 2:00 AM” or “at 2:00 AM backup.sh” depending on the exam format. Another pattern is listing current jobs: “How can you view all pending 'at' jobs?” with the answer being “atq” or “at -l”.

Troubleshooting questions are also common. For example: “A user schedules a job with 'at', but it does not run. What should you check first?” The answer might include verifying that the 'atd' daemon is running, checking the spool directory permissions, or confirming the user is in the at.allow file. Scenario-based questions describe a system administrator who needs to run a script once at a specific time but cannot use cron because the task is one-time. The question asks for the best tool, and 'at' is the correct choice.

Configuration questions test access control: “An administrator wants to allow only the user 'joe' to use 'at'. What should they do?” The solution involves creating /etc/at.allow with 'joe' listed. Another question might ask: “A user gets 'You do not have permission to use at.' What is the most likely cause?” This tests knowledge of at.deny and at.allow files.

Finally, comparison questions appear: “What is the primary difference between 'at' and 'cron'?” The answer focuses on one-time vs. recurring execution. These patterns show that understanding 'at' syntax, daemon management, and security files is essential for passing the exam.

Study CompTIA Linux+

Test your understanding with exam-style practice questions.

Practise

Example Scenario

You are a junior system administrator at a small company that runs an e-commerce website. The marketing team wants to send a promotional email to all customers at 10:00 AM on the first day of next month. You cannot stay up until that time to run the script manually, and the script should only run once.

You log in to the Linux server that hosts the email system. The script is located at /home/marketing/promo_email.sh. You decide to use the 'at' command. First, you check that the 'atd' daemon is running with the command 'systemctl status atd'. It is active. Next, you schedule the job by typing: 'at 10:00 AM March 1 2025'. The 'at' prompt appears, showing a 'at>' prompt. You type the full path to the script: '/home/marketing/promo_email.sh', then press Ctrl+D to exit and save the job.

The system responds with a message like “job 12 at Thu Mar 1 10:00:00 2025.” You then verify the job is in the queue by typing 'atq'. It lists job number 12 with the correct time. On March 1 at 10:00 AM, the system runs the script, the emails are sent, and the job is removed from the queue. You later confirm with the marketing team that the campaign worked perfectly. This scenario shows how 'at' solves a real-world one-time scheduling problem without requiring cron or manual intervention.

Common Mistakes

Using 'at' without specifying the time correctly, for example typing 'at 10 AM' but forgetting to include AM/PM or using a 24-hour format incorrectly.

The 'at' command interprets time strings in a specific way. If you type 'at 10', it assumes 10:00 AM, but if you meant 10 PM and did not specify, the job runs at the wrong time.

Always use a clear time format. For example, 'at 10:00 PM' or 'at 22:00' for 24-hour format. Use keywords like 'noon' or 'midnight' to avoid ambiguity.

Forgetting that 'at' captures environment variables at scheduling time, not execution time. Users then wonder why a command works interactively but fails when run by 'at'.

If a script relies on environment variables set after the 'at' command was issued, those variables will not exist when the job runs, causing failures.

Set all needed environment variables inside the script itself, or use full paths for commands and files. Test the script manually first, then schedule it with 'at'.

Assuming 'at' jobs persist across reboots. Some users think that after a reboot, the job will still run.

The 'at' spool files are stored in a volatile directory like /var/spool/at. On many systems, these files are cleared on reboot or require the 'atd' daemon to re-read them.

If you need a job to survive a reboot, use cron or a systemd timer. For 'at', ensure the system will not reboot before the scheduled time, or check that the spool directory is persistent.

Trying to use 'at' with a relative time like 'at now + 1 day' but confusing the order of arguments.

The correct syntax is 'at now + 1 day', but users might write 'at +1 day now' or skip 'now', which causes a syntax error.

Use the exact format: 'at now + 1 day' or 'at now + 5 minutes'. Test with 'at -v' to see the interpreted time before finalizing.

Ignoring output. Users schedule a job with 'at' and expect to see output on their terminal, but they get nothing.

By default, 'at' sends output via email to the user (if mail is configured). If no mail system is set up, the output is lost.

Redirect output to a file inside the command, for example: '/home/script.sh > /tmp/output.log 2>&1'. Or use the 'm' option to force mail delivery.

Exam Trap — Don't Get Fooled

{"trap":"In an exam, a question states: 'Which command schedules the script /home/user/test.sh to run at 11:30 PM?' Options include 'at 11:30 PM test.sh', 'at 23:30 test.sh', 'echo test.

sh | at 23:30', and 'at -f test.sh 23:30'. Many learners choose 'at 23:30 test.sh' because it looks correct.","why_learners_choose_it":"Learners think 'at' can take the command as a direct argument after the time, like 'at 5:00 PM command'.

But in many versions of 'at', the command must be provided via stdin or a file, not on the same line.","how_to_avoid_it":"Read the man page or exam objectives carefully. For most Linux distributions, you must use either interactive input (typing the command after the at> prompt) or piping (echo 'test.

sh' | at 23:30). The direct syntax 'at time command' is not standard. In exams, look for the pipe or the '-f' option for file input."

Step-by-Step Breakdown

1

Command Invocation

User types 'at' followed by a time specification. The shell interprets the command and runs the 'at' binary, which opens an interactive prompt or reads from stdin if piped. This step starts the scheduling process.

2

Input Capture

If running interactively, the 'at' prompt (at>) appears. The user types each command line and presses Enter. When finished, the user presses Ctrl+D to signal End-of-File. The commands are collected into a batch.

3

Job Creation

The 'at' command creates a job file in the spool directory, usually /var/spool/at. The file contains the commands, the execution time, environment variables, and the user ID. A unique job identifier (like 'a000010123456') is assigned.

4

Queue Entry

The job is now in the at queue. The 'atq' command lists all pending jobs with their job ID, time, and user. The job remains in the queue until its execution time or until removed with 'atrm'.

5

Daemon Monitoring

The 'atd' daemon runs continuously, usually checking the spool directory every 60 seconds. It reads each job file, compares the scheduled time with the system clock, and identifies which jobs are due to run.

6

Job Execution

When the scheduled time matches, 'atd' forks a new process to run the commands in the job file. The process runs with the original user's permissions and environment. The working directory is set to the user's home directory at scheduling time.

7

Cleanup and Notification

After execution, the job file is deleted from the spool directory. If the job produced output and mail is configured, 'atd' sends the output via email to the user. The job is now complete and no longer appears in 'atq'.

Practical Mini-Lesson

To use 'at' effectively in practice, first ensure the 'at' package is installed and the 'atd' daemon is running. On RHEL/CentOS, install with 'yum install at' and enable with 'systemctl enable --now atd'. On Debian/Ubuntu, it's usually installed by default. Always verify with 'systemctl status atd'.

When scheduling, use relative times when possible because they are less error-prone. For example, 'at now + 1 hour' is clearer than calculating an absolute time. If you need to run a script with arguments, use a wrapper script or include the arguments in the command inside 'at'. For complex commands, create a separate script file and schedule that script-it's more maintainable.

Professionals often use 'at' in shell scripts for dynamic scheduling. For instance, a backup script might use 'at now + 5 minutes' to schedule a confirmatory email after the backup completes. Another common pattern is using 'at' with 'mail' to send notifications at specific times without writing a cron job.

What can go wrong? The most common issue is a stopped 'atd' daemon. Check with 'ps -ef | grep atd'. Another issue is permission: if the user is not in at.allow, they get 'Permission denied'. Also, ensure the system clock is accurate, because 'atd' uses the system time. If the time changes (e.g., daylight saving), jobs may run an hour early or late.

For exam prep, practice 'at' interactively and using pipes. Write commands like 'echo "ls -l" | at now + 1 minute' and immediately check with 'atq'. Then delete with 'atrm'. This hands-on experience will solidify your understanding and help you answer performance-based questions confidently.

Memory Tip

Think 'at' for 'one-and-then-done', it runs a job exactly once at a specified time, unlike cron which repeats.

Covered in These Exams

Current Exam Context

Current exam versions that test this topic — use these objectives when studying.

Legacy Exam Context

Older materials may mention these exam versions, but learners should use the current objectives for their target exam.

XK0-005XK0-006(current version)

Related Glossary Terms

Frequently Asked Questions

Can I schedule an 'at' job to run on a specific date, like December 25?

Yes. You can use the format 'at 10:00 AM December 25'. You can also use relative dates like 'at noon tomorrow' or 'at 3:00 PM next Friday'.

How do I see all the jobs I have scheduled with 'at'?

Use the 'atq' command. It lists all pending 'at' jobs for your user, showing the job ID, scheduled time, and queue. Root can see all users' jobs.

What happens if I schedule an 'at' job and then the system shuts down before it runs?

When the system comes back up, if the 'atd' daemon restarts, it will run missed jobs if the scheduled time has passed. However, this behavior depends on the at implementation; some versions discard missed jobs. It is not reliable for critical tasks.

Can I use 'at' to schedule a job that repeats every hour?

No, 'at' is for one-time jobs only. For repeating jobs, use cron or a systemd timer. Using 'at' to re-schedule itself is possible but messy and not recommended.

Why does my 'at' job run but produce no output?

By default, 'at' sends output via email to the user. If your system doesn't have mail configured (like sendmail or postfix), the output is lost. Redirect output to a file using '> /tmp/output.log 2>&1' inside the job.

Is there a way to specify the time in 24-hour format?

Yes. You can use 'at 14:30' for 2:30 PM. The 'at' command accepts both 12-hour and 24-hour formats. Make sure to include AM/PM if using 12-hour format to avoid ambiguity.

Can I schedule an 'at' job as a different user?

Only root can schedule jobs for other users using 'at -u username'. Regular users can only schedule jobs for themselves.

Summary

The 'at' command is a simple yet powerful tool for scheduling one-time tasks on Unix-like systems. It fills a specific niche that cron does not cover: tasks that need to run at a precise time but only once. Whether you are a system administrator automating a maintenance window or a student preparing for Linux certification exams, understanding 'at' is essential.

The command is straightforward: specify a time, provide the command, and the system handles the rest. You can monitor jobs with 'atq', remove them with 'atrm', and control access with at.allow and at.deny files. Common pitfalls include forgetting about environment variable capture, misconfiguring the daemon, or confusing 'at' with 'batch' or 'cron'.

In exams, 'at' appears in multiple-choice, fill-in-the-blank, and performance-based questions. Mastery of 'atq', 'atrm', and the interactive vs. pipe input methods will serve you well. The key takeaway is: use 'at' for one-time future tasks, and use cron for recurring tasks. This clarity will help you answer questions correctly and apply the tool effectively in real-world IT environments.