miniguide

Linux Cron Cheatsheet: Schedule and Manage Cron Jobs for DevOps

Introduction

This cheatsheet provides examples of managing cron jobs on Linux, including scheduling, editing, and troubleshooting automated tasks.

Table of Contents

1. View Current Cron Jobs

crontab -l

2. Edit Crontab

crontab -e

3. Cron Job Format

# m h dom mon dow command

4. Schedule a Job to Run Every Minute

* * * * * /path/to/script.sh

5. Schedule a Job Daily

0 2 * * * /path/to/daily-backup.sh

6. Schedule a Job Weekly

0 3 * * 0 /path/to/weekly-report.sh

7. Schedule a Job Monthly

0 4 1 * * /path/to/monthly-cleanup.sh

8. Run a Job at a Specific Time

30 5 15 6 * /path/to/special-task.sh

9. List System Cron Jobs

sudo cat /etc/crontab

10. Log Cron Output

* * * * * /path/to/script.sh >> /var/log/cron.log 2>&1