• Home
  • News
  • Software
  • Knowledge
  • MMO
  • Tips
  • Security
  • Network
  • Office
AnonyViet - English Version
  • Home
  • News
  • Software
  • Knowledge
  • MMO
  • Tips
  • Security
  • Network
  • Office
No Result
View All Result
  • Home
  • News
  • Software
  • Knowledge
  • MMO
  • Tips
  • Security
  • Network
  • Office
No Result
View All Result
AnonyViet - English Version
No Result
View All Result

How to schedule a task with the at command on Linux

AnonyViet by AnonyViet
January 25, 2023
in Network
0

Automation is great, but not everyone knows how to automate tasks. However, being able to schedule a task for a computer at a specific time is equally as good. So in this article, I will show you how to schedule tasks using the at command in Linux.

Join the channel Telegram of the AnonyViet 👉 Link 👈

How to schedule a task with the at command on Linux

What is the at command?

at is a Linux command that allows you to schedule jobs for a specific date and time. It’s automation made easy from Terminal.

How to install

On Linux, the at command may already be installed by default. You can verify it is installed with the command at -V:

$ at -V
at version x.y.z

If you can’t find the at command, most modern Linux distributions provide an at command installation package for you.

You may also need to start at daemon, called atd. On most Linux systems, you use the systemctl command to enable services and allow them to automatically start from now on:

$ sudo systemctl enable --now atd

How to schedule an interactive task with the at . command

You first need to create an event at some point and then you specify what you want to happen.

For example, try scheduling by creating a task for the next few minutes. Just do a simple task. To exit the terminal, press Ctrl + D on your keyboard.

$ at 11:20 AM
warning: commands will be executed using /bin/sh
at> echo "hello world" > ~/at-test.txt
at> <EOT>
job 3 at Mon Jul 26 11:20:00 2021

As you can see, at uses intuitive and natural time definitions. You don’t need to know the 24 hours or convert to UTC. In general, you can use any time notation such as noon, 1:30 PM, 13:37,… to describe the moment you want.

Wait a few minutes and then see if the word “hello world” has been written to the file at-text.txt using the cat command.

$ cat ~/at-test.txt
hello world

How to schedule a task with the at . command

You don’t need to write dance on terminal to schedule jobs with at. You can use the echo or printf command instead. In this example, I will use now to delay that task for 1 minute.

$ echo "echo 'hello again' >> ~/at-test.txt" | at now +1 minute

After a minute, you need to confirm the task has been completed with the cat command.

$ cat ~/at-test.txt
hello world
hello again

Time options

The at command is quite easy to manipulate with time options. You can choose between several formats, depending on which is most convenient for you:

  • YYMMDDhhmm[.ss] (abbreviation for year, month, day, hour, minute and second)
  • CCYYMMDDhhmm[.ss] (full year, month, day, hour, minute and second)
  • now
  • midnight
  • noon
  • teatime (4 PM)
  • AM
  • PM

Times and dates can be absolute or add a plus sign (+) to make them relative to now.

  • minutes
  • hours
  • days
  • weeks
  • months
  • years

Date and time syntax

The at command is less comfortable when dealing with dates and times. The time must be entered first, then the date, even though that date defaults to the current date and only scheduled tasks for some future date.

Eg:

$ echo "rsync -av /home/tux me@myserver:/home/tux/" | at 3:30 AM tomorrow
$ echo "/opt/batch.sh ~/Pictures" | at 3:30 AM 08/01/2022
$ echo "echo hello" | at now + 3 days

View task queue

You can view your scheduled jobs on Linux with the atq command:

$ atq
10 Thu Jul 29 12:19:00 2021 a tux
9  Tue Jul 27 03:30:00 2021 a tux
7  Tue Jul 27 00:00:00 2021 a tux

To remove a job from the queue, use the atrm command. To remove job #7:

$ atrm 7
$ atq
10 Thu Jul 29 12:19:00 2021 a tux
9  Tue Jul 27 03:30:00 2021 a tux

In addition, you can also see 10 more dangerous Linux commands you absolutely should not try here.

The article achieved: 4.8/5 – (113 votes)

Tags: CommandLinuxscheduleTask
Previous Post

Lesson 158: How to use the Offset function in Excel

Next Post

Lesson 160: Lookup on the left in Excel

AnonyViet

AnonyViet

Related Posts

Save image as Type contains malicious code: Remove immediately before losing money unfairly!
Network

Save image as Type contains malicious code: Remove immediately before losing money unfairly!

March 19, 2026
Instructions on how to register a .co.uk domain name for free for 1 year
Network

Instructions on how to register a .co.uk domain name for free for 1 year

March 12, 2026
How to Setup Paperclip AI: Create a Company for AI Agent
Network

How to Setup Paperclip AI: Create a Company for AI Agent

March 12, 2026
Compilation of free and cheap APIs to run OpenClaw stably
Network

Compilation of free and cheap APIs to run OpenClaw stably

March 10, 2026
3 Services to Determine IP Location for Website (IP Geolocation API)
Network

3 Services to Determine IP Location for Website (IP Geolocation API)

March 10, 2026
How to buy a .STORE domain name for 1 USD (2026): Detailed instructions from A–Z
Network

How to buy a .STORE domain name for 1 USD (2026): Detailed instructions from A–Z

March 3, 2026
Next Post
Lesson 160: Lookup on the left in Excel

Lesson 160: Lookup on the left in Excel

0 0 votes
Article Rating
Subscribe
Login
Notify of
guest

guest

0 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments

Recent News

Instructions for looking up prescriptions on VNeID instead of paper medical books

Instructions for looking up prescriptions on VNeID instead of paper medical books

April 26, 2026
Tips to completely turn off CAPTCHA codes on iPhone and Mac are super simple

Tips to completely turn off CAPTCHA codes on iPhone and Mac are super simple

April 25, 2026
Compare Poco X8 Pro and Poco X7 Pro: A new step for the “king” of mid-range performance

Compare Poco X8 Pro and Poco X7 Pro: A new step for the “king” of mid-range performance

April 24, 2026
How to compress online videos for free without losing quality

How to compress online videos for free without losing quality

April 24, 2026
Instructions for looking up prescriptions on VNeID instead of paper medical books

Instructions for looking up prescriptions on VNeID instead of paper medical books

April 26, 2026
Tips to completely turn off CAPTCHA codes on iPhone and Mac are super simple

Tips to completely turn off CAPTCHA codes on iPhone and Mac are super simple

April 25, 2026
Compare Poco X8 Pro and Poco X7 Pro: A new step for the “king” of mid-range performance

Compare Poco X8 Pro and Poco X7 Pro: A new step for the “king” of mid-range performance

April 24, 2026
AnonyViet - English Version

AnonyViet

AnonyViet is a website share knowledge that you have never learned in school!

We are ready to welcome your comments, as well as your articles sent to AnonyViet.

Follow Us

Contact:

Email: anonyviet.com[@]gmail.com

Main Website: https://anonyviet.com

Recent News

Instructions for looking up prescriptions on VNeID instead of paper medical books

Instructions for looking up prescriptions on VNeID instead of paper medical books

April 26, 2026
Tips to completely turn off CAPTCHA codes on iPhone and Mac are super simple

Tips to completely turn off CAPTCHA codes on iPhone and Mac are super simple

April 25, 2026
No Result
View All Result
  • Home
  • News
  • Software
  • Knowledge
  • MMO
  • Tips
  • Security
  • Network
  • Office

wpDiscuz
0
0
Would love your thoughts, please comment.x
()
x
| Reply