-
-
Notifications
You must be signed in to change notification settings - Fork 2
Linux cron Guide
Mattscreative edited this page Dec 5, 2025
·
2 revisions
Complete beginner-friendly guide to cron on Linux, covering Arch Linux, CachyOS, and other distributions including installation, crontab configuration, and scheduled tasks.
cron schedules tasks to run automatically.
Components:
- cron daemon: Runs scheduled tasks
- crontab: User's cron configuration
- cron jobs: Scheduled commands
Common uses:
- Backups: Automated backups
- Updates: System updates
- Maintenance: Regular maintenance
Arch/CachyOS:
# Install cronie
sudo pacman -S cronie
# Enable service
sudo systemctl enable --now cronieDebian/Ubuntu:
sudo apt install cronFedora:
sudo dnf install cronieCheck cron:
# Check service
systemctl status cronie
# Check crontab
crontab -lEdit user crontab:
# Edit crontab
crontab -e
# List crontab
crontab -l
# Remove crontab
crontab -rSystem-wide:
# Edit system crontab
sudo vim /etc/crontab
# Or add to /etc/cron.d/Cron syntax:
* * * * * command
│ │ │ │ │
│ │ │ │ └── Day of week (0-7, 0 or 7 = Sunday)
│ │ │ └──── Month (1-12)
│ │ └────── Day of month (1-31)
│ └──────── Hour (0-23)
└────────── Minute (0-59)
Common examples:
# Every minute
* * * * * command
# Every hour
0 * * * * command
# Daily at midnight
0 0 * * * command
# Weekly on Sunday
0 0 * * 0 command
# Monthly on 1st
0 0 1 * * commandCheck service:
# Check cron service
systemctl status cronie
# Check logs
journalctl -u cronie
# Or cron log
grep CRON /var/log/syslogCheck crontab:
# List crontab
crontab -l
# Check syntax
# Use absolute paths
# Set environment variablesThis guide covered cron installation, crontab configuration, and scheduled tasks for Arch Linux, CachyOS, and other distributions.
- System Configuration - System setup
- Backup and Restore - Automated backups
-
cron Documentation:
man crontab
This guide covers Arch Linux, CachyOS, and other Linux distributions. For distribution-specific details, refer to your distribution's documentation.