Ubuntu Terminal: How to Back up Your Crontab File CodeUnit 24 DEC 2010

To generate a back up of a crontab file is actually pretty simple, making use of the built in -l switch that comes with the command:

sudo crontab -l > ~/path/to/your/backup/file

See what we did there? The -l switch spits out the crontab file’s contents and we simply pipe that into a file. Easy peasy. Note that sudo crontab and crontab are two different files, meaning you might want to backup both if you make use of the two different cron job files…

About Craig Lotter

Software developer, husband and dad to two young ladies. Writer behind An Exploring South African. I don't have time for myself any more.