crontab commands: edit, list, remove and test your cron jobs
The crontab command manages your list of scheduled jobs. Five options cover nearly everything.
The options from the manual
The crontab(1) manual page of the cronie project (page dated 3 August 2026) describes these options.
| Command | What it does |
|---|---|
crontab -e | Opens your crontab in the editor named by the VISUAL or EDITOR variable. When you save and close, the new crontab is installed automatically |
crontab -l | Shows your current crontab on the screen |
crontab -r | Removes your whole crontab, with no question asked |
crontab -r -i | Same, but asks you to type y or Y first |
crontab -u name | Works on the crontab of another user. Without it you work on your own |
crontab -T file | Tests the syntax of a crontab file without installing it. It stops at the first problem it finds, so it does not list every error at once |
A safe working order
- Look first:
crontab -l. If it prints nothing, you have no crontab yet. - Copy it to a file before you change it:
crontab -l > ~/crontab.backup. - Open it for editing:
crontab -e, add the line, save. - List again to be sure it was installed.
The manual says that when you edit or delete a crontab, a backup of the last crontab is saved to $XDG_CACHE_HOME/crontab/crontab.bak, or to $HOME/.cache when that variable is not set. Keep your own copy as well.
The dangerous one
The letters e and r are next to each other on the keyboard. crontab -r removes everything without confirmation. If you ever type it by mistake, the automatic backup above is the first place to look. Many people alias it to the asking version, or never use it at all and edit the file with -e and delete lines.
Replacing from a file
You can install a file as your crontab by giving it as an argument: crontab mycron.txt. The manual says that when reading from standard input on a terminal you must write a dash, crontab -. After this, the old crontab is gone, so merge by hand if you need both.
Who may use it
The files /etc/cron.allow and /etc/cron.deny decide who may use the crontab command. If cron.allow exists, only listed users may. Otherwise users listed in cron.deny may not. If neither file exists, only the super user may. The manual adds that these files restrict the use of the command, not jobs already installed: an existing crontab keeps running until it is removed.
The system crontab
The manual also describes /etc/crontab and files in /etc/cron.d/. These system jobs have an extra field after the five time fields: the name of the user the command runs as. Putting a line without the user name in such a file is a classic mistake: the command is then read as the user name.
What is the editor if EDITOR is not set?
That depends on your system: it may ask you to choose one. Set it once with export EDITOR=nano in your shell profile.
Does the Windows computer have crontab?
No. Windows has Task Scheduler. The expressions on this site are for Linux, Mac, GitHub Actions, Kubernetes and Quartz.
This is an independent guide and tool. It is not connected with crontab.guru, Quartz, GitHub, Kubernetes, Spring or the Linux projects named here. Product names belong to their owners.