You have one command or one program that you want executed automatically at a specific moment, like tomorrow at 4 am, in 1 hour from now, or every day at 11 pm.
Each tool has its own specific use case. For backups, you would probably want to schedule them automatically at a time that does not affect your work. In this case, you should use cron. It is a native feature of Linux that reads the crontab every minute and checks if any of the rules match the current time.
To edit the crontab, type:
crontab -e
If it is the first time you edit this file, it will ask you which editor you want to use. If you are not familiar with vi or vim, use nano, which is more intuitive.
Inside this file, called the cron table, you have to use the proper syntax to tell the system when your command needs to be executed.

Let’s assume the command you want to run every minute is pinging another server on the internet to check if the connection is working:
* * * * * * ping test.com -c 1
It will run the command every minute because the cron parameters will match the current time every time it checks.
Let’s assume the command you want to run is to shut down the machine every day at 11:00 pm:
* 0 23 * * * sudo shutdown now
Note that you have to use 24h syntax, not AM or PM.
This will only execute when the clock turns to 23:00. If you turn on your computer at 23:01, it will only run the command the next day.
Let’s assume the command you want to run is to update the database used by the locate command, so you can locate files with a database no older than one day:
* * 22 * * * sudo updatedb
There is a logical error in this command. It will run not just once at 10 pm, but every minute from 22:00 to 22:59. This is likely not what you want and will create unnecessary load on the computer during that hour.
To fix this, set a precise time to run it, for example 30 minutes into the hour:
* 30 22 * * * sudo updatedb
There are situations where you want to run a command only once at a specific time, not periodically. For this, you can use the at command.
Let’s assume you are at work and want to download a large file, but you don’t want to slow down the internet for everyone else. A simple solution is to schedule the download for after company hours:
at 19:00 -f ./Downloads/script.sh
This script will run only once at 7 pm.
at now + 30 minutes -f ./Downloads/script.sh
In this example, the script will run only once, 30 minutes from now.
RELATED TOOLS
Cronitor – Crontab.Guru [Link]. The best two-way translator for cron syntax.
AnaCron is a command used to execute commands periodically based on a frequency interval [Link]. It checks whether the time since a command last ran exceeds the defined interval, rather than running at a specific time.
sudo apt install anacron -y cat /etc/anacrontab
Use Cronic to wrap commands in cron or anacron. It will only send email notifications when the wrapped command exits with a non-zero status [Link].
sudo apt install cronic -y
The at command is a scheduler for one-time execution at an exact time.
sudo apt install at -y sudo systemctl status atd
Example:
at 10:45 at> echo `date` > /tmp/output.txt
Use Ctrl+D to exit.
You can use atq to see the queue of scheduled commands and atrm to remove any scheduled job.