How to run crontab job every minute on a Linux or Unix-like system
To run a crontab job every minute on a Linux or Unix-like system, you can use the following syntax:
* * * * * command-to-be-executedThis will run the command-to-be-executed every minute of every hour of every day of the week.
Here's a breakdown of what each * represents:
*in the first field represents the minute*in the second field represents the hour*in the third field represents the day of the month*in the fourth field represents the month*in the fifth field represents the day of the week
* in all five fields, it means that the job will run every minute of every hour of every day of the month, every month, and every day of the week.To add a job to the crontab, follow these steps:
- Open a terminal or shell prompt.
- Type
crontab -eto open the crontab in the default editor. - Add the following line to the crontab file:
* * * * * command-to-be-executedReplace
command-to-be-executedwith the command that you want to run every minute. - Save the changes and exit the editor.
