Crontab jobs and format, terminal commands

mm hh jj MMM JJJ job > log

Crontab format

# ┌───────────── minute (0 - 59)
# │ ┌───────────── hour (0 - 23)
# │ │ ┌───────────── day of the month (1 - 31)
# │ │ │ ┌───────────── month (1 - 12)
# │ │ │ │ ┌───────────── day of the week (0 - 6) (Sunday to Saturday;
# │ │ │ │ │ 7 is also Sunday on some systems)
# │ │ │ │ │
# │ │ │ │ │
# * * * * * command to execute

Example of a crontab

30 8 * * * ls -alt > /tmp/crontab_log
*/10 * * * * df -h > /tmp/crontab_log

Crontab generator

Example of crontab generator

Where to find default crontab file?

List of crontab terminal commands

Display your crontab

crontab -l
Example crontab -l

Remove your crontab file

crontab -r

Edit your crontab file

crontab -e
Edit your crontab
Save it

Display the last time you edited your crontab file

crontab -v

Install filename as your crontab file

crontab -a filename
Set new crontab file

User crontab commands

crontab -u user

P.S. VIM & Nano

sudo apt-get install nano
yum install nano
brew tap homebrew/dupes
brew install nano
export EDITOR=nano crontab -e

Thank you for your attention

Senior web developer, architect, cryptocurrencies trader, https://lytvynov-anton.com

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store