How to Schedule One-Time Tasks with the at Command
The at command runs a command once at a time you choose. echo 'shutdown -h now' | at 23:00 schedules the shutdown for 11 PM. Unlike cron, which repeats, at is for one-off jobs.
Schedule a command with echo and at
Pipe the command you want to run into at, followed by the time. at reads the command from standard input and confirms the job number and time.
Relative times
at understands phrases like now + 1 hour, now + 2 days and noon. This is the easy way to run something in an hour without calculating a clock time.
List pending jobs with atq
atq lists every queued job with its number, time and queue. Check it to confirm your job was scheduled.
Cancel a job with atrm
Change your mind? Remove a job by its number from atq.
at vs cron
Use at for a single run and cron for recurring schedules like daily backups. Many minimal systems need the package installed first. See at for the full reference.
Keep learning
Related guides: How to Schedule Tasks in Linux with cron · How to Write Your First Bash Script · Linux Redirection and Pipes: A Practical Guide. Read all tutorials on the Learn Linux blog.