September 21, 2025
Linux Command Line

Linux Command Line

The “at” command in Linux is a powerful tool for scheduling commands or scripts to run at a specific time or date. This can be useful for automating repetitive tasks or for running commands at a time when you will not be present to manually execute them. In this article, we will discuss when to use the “at” command, how to use it, and provide some examples of its usage.

When to Use the “at” Command

The “at” command is most useful when you need to schedule a command or script to run at a specific time or date. This could be used for tasks such as running backups, sending emails, or updating databases. The “at” command is also useful when you need to schedule a command to run when you will not be present to manually execute it, such as when you are away from your computer or working on another task.

Using the “at” Command

The basic syntax of the “at” command is as follows:

at [time] [date]

The time and date arguments can be specified in a variety of formats, such as “noon” or “midnight” for time, and “tomorrow” or “next friday” for date. If a time is not specified, the command will run at the next scheduled time. If a date is not specified, the command will run on the current date.

For example, to schedule a command to run at 2:00 PM tomorrow, you would use the following command:

at 2pm tomorrow

Once the “at” command is executed, you will be prompted to enter the command or script you want to run. Once you have entered the command, press ctrl+d to exit.

Examples of the “at” Command

Here are a few examples of how the “at” command can be used:

  • To schedule a command to run a backup at 1:00 AM every day, you could use the following command:
at 1am every day /path/to/backup.sh
  • To schedule a command to run a script that sends an email every Monday at 10:00 AM, you could use the following command:
at 10am on Mon /path/to/email.sh
  • To schedule a command to run a script that updates a database every hour, you could use the following command:
at now +1 hour /path/to/update.sh

It’s also important to mention that you can check your scheduled jobs with the command atq and delete them with atrm job_number, where job_number is the number of the job you want to delete.

In conclusion, the “at” command in Linux is a powerful tool for scheduling commands or scripts to run at a specific time or date. It can be useful for automating repetitive tasks or for running commands at a time when you will not be present to manually execute them. With the understanding and examples provided in this article, you should be able to use the “at” command to schedule tasks on your Linux system.

See our list of 75 Linux commands you should know about.

0 0 votes
Article Rating
Subscribe
Notify of
guest
0 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x
Share via
Copy link
Powered by Social Snap