Using Crontab in Linux

Video is ready, Click Here to View ×

This is one of the most overlooked aspects of Linux. With Crontab, you can basically schedule anything you. Match this with the power of shell scripting, then you can have a whole system, or an office of systems maintain themselves.


Let’s make a script that runs every day and updates your system (this is for Debian based systems like Ubuntu or Mint if you have Aptitude installed). Create an empty file called and paste the following:



  1. I would seriously reconsider the command 'rm * /var/tmp'. This will just wipe out all the files in the current directory and could lead to a small disaster. 'rm /var/tmp/*' comes closer. 'rm -f /var/tmp/* 2>/dev/null' is even better. All IMHO. Of course 🙂

  2. linuxfornewbs by a newb… You do realize that this script will just wipe out your startup scripts. Either your just plain dumb or trying to ruin some new persons install. Flagging this crap so no newbies wipes out their start up scripts

  3. Exact running hours for /etc/cron.daily/ and so on should be in /etc/crontab. You can set that manually, but as default it should run at that time exact, 4:02 AM in my case. And If you really don't wanna miss that script to run, anacron can be used instead.

Leave a Reply

Your email address will not be published.