📡 You're offline — showing cached content
New version available!
Quick Access
Tutorials Linux Command Line Cron Jobs

Cron Jobs

5 min read Quiz at the end
crontab -e schedules recurring tasks with cron syntax. Format: minute hour day month weekday command. Always use full paths in cron commands. Redirect output to a log file to capture errors from jobs.

Scheduling with Cron

crontab -e    # edit your cron jobs
crontab -l    # list cron jobs

# Format: minute hour day month weekday command
# * means "every"

# Every day at 2:30 AM
30 2 * * * /usr/local/bin/backup.sh

# Every Monday at midnight
0 0 * * 1 /usr/local/bin/weekly.sh

# Every 5 minutes
*/5 * * * * /usr/local/bin/ping_check.sh

# Redirect output
30 2 * * * /backup.sh >> /var/log/backup.log 2>&1
Topic Quiz · 5 questions

Test your understanding before moving on

1. What does cron do?
💡 cron is a time-based job scheduler that runs commands at specified intervals.
2. How do you edit your crontab?
💡 crontab -e opens your personal crontab for editing.
3. In cron "* * * * *" means:
💡 Five asterisks means every minute of every hour of every day.
4. What does "0 2 * * *" mean?
💡 minute=0, hour=2, day=*, month=*, weekday=* → runs at 2:00 AM every day.
5. Where are system-wide cron jobs?
💡 /etc/crontab and the files in /etc/cron.d/ define system-wide cron jobs.