Skip to content

UNIX Crontab Basics

A crontab file has five fields for specifying day , date and time followed  by the command to be run at that interval.
# Minute     Hour    Month Day      Month       Weekday                      Command
#  0-59       0-23      1-31                 1-12           0-6 (0=Sunday)


* * * * * command to be executed
– – – – –
| | | | |
| | | | +—– day of week (1 – 7) (monday = 1)
| | | +——- month (1 – 12)
| | +——— day of month (1 – 31)
| +———– hour (0 – 23)
+————- min (0 – 59)
crontab -e Edit your crontab file, or create one if it doesn’t already  exist.
crontab -l Display your crontab file.
crontab -r Remove your crontab file.
crontab -v Display the last time you edited your crontab file.



To run the calendar command at 6:30 a.m. every Monday, Wednesday, and Friday, enter:

To run the calendar command every day of the year at 6:30, enter the following:


To run a script called maintenance every day at midnight in August, enter the following:



You can execute crontab if your name appears in the file /usr/lib/cron/cron.allow. If that file does not exist, you can use  crontab if your name does not appear in the file  /usr/lib/cron/cron.deny.  If only cron.deny exists and is empty, all users can use crontab. If neither  file exists, only the root user can use crontab. The allow/deny files  consist of one user name per line.

[Post Views: 1802]

Brijesh Gogia

I’m an experienced Oracle Applications DBA with more than a decade of full-time DBA experience. I have gained a wide knowledge of the Oracle software stack and have worked on several big projects for multi-national companies. I enjoy working with the leading-edge technology and have passion for database performance and stability. Thankfully my work allows me time for researching new technologies (and to write about them).
You can connect with me on LinkedIn.

Be First to Comment

Leave a Reply

Required fields are marked *