Schedule and automate recurring Linux tasks with crontab, the classic time-based job scheduler. 03.03.2026 | reading time: 2 min Crontab is the command-line gateway to cron, the time-based job scheduler on Linux; he will use it to schedule scripts, maintenance and backups at fixed times and intervals. Nightly backup example A concrete task: install a nightly backup that runs at 02:00 and appends logs; run these commands to install and verify the entry: ```\necho '0 2 * * * /usr/local/bin/daily-backup.sh >> /var/log/backup.log 2>&1' | crontab -\ncrontab -l\n# Output:\n0 2 * * * /usr/local/bin/daily-backup.sh >> /var/log/backup.log 2>&1\n``` Control environment and timing Crontab entries obey five timing fields: minute hour day month weekday, or special strings like @reboot and @daily; remember that the crontab environment is minimal so set PATH or SHELL inside a crontab, and edit /etc/crontab for system-wide jobs which include a user column. ```\n# user crontab example\n@reboot /usr/local/bin/restore-tmp.sh\n# system crontab example (has a user column)\n0 3 * * * root /usr/local/bin/system-maintenance.sh\n``` Prevent overlaps and capture output Edit with `crontab -e`, list with `crontab -l` and remove with `crontab -r`; `crontab -u` targets another user when run as root. Use output redirection or MAILTO to receive failures, and prevent overlapping runs with `flock` to ensure only one instance runs at a time: ```\n* * * * * /usr/bin/flock -n /var/lock/myjob.lock /usr/local/bin/job.sh >> /var/log/job.log 2>&1\n``` When to pick alternatives Crontab is great for simple recurring jobs, but use anacron for machines that are often powered off, at for one-shot scheduling, and systemd timers for richer dependency and logging integration; he should also inspect logs with journalctl or syslog to confirm runs. Take it further Try small, then iterate: schedule a harmless script, verify logs, and add PATH settings to your crontab; then practice with system crontabs and systemd timers to compare behavior. Consider formalizing skills for certification like CompTIA Linux+ or LPIC-1 and use intensive exam preparation at bitsandbytes.academy to accelerate learning. Join Bits & Bytes Academy First class LINUX exam preparation. utilities scripting backup