Linux / Unix – crontab: no crontab for user using an empty one error and solution

The error “crontab: no crontab for user using an empty one” occurs when you try to edit the crontab file of a user that doesn’t have a crontab file yet. The solution is to create a new crontab file for the user:

  1. Open a terminal window.
  2. Run the following command to create a new crontab file for the current user:
crontab -e
  1. The crontab editor will open. If you’re creating a new crontab file, it will be empty.
  2. Add your cron jobs to the file in the following format:
* * * * * command
  1. Each field represents a different aspect of the schedule:
- minute (0-59)
- hour (0-23)
- day of the month (1-31)
- month (1-12)
- day of the week (0-7, where both 0 and 7 represent Sunday)
  1. For example, the following cron job will run the command ls -l every day at midnight:
0 0 * * * ls -l
  1. Save the file and exit the editor.
  2. The new crontab file will be installed and the cron job(s) will start running at the specified intervals.

Note: If you want to edit an existing crontab file, simply run the same command as above: crontab -e.

Leave a Comment