Tag: crontab

  • Where is the crontab in Ubuntu?

     

    If you’re looking to make a copy of a user’s crontab as a backup or just to view it without using the crontab editor, you can locate it at:

     

    /var/spool/cron/crontabs

     

    Each user’s crontab will be in this directory in a file named as their username (e.g. root). If you’re working with a lengthy crontab it’s a good idea to back it up – can save you a lot of work if everything goes pear-shaped.

  • How to easily find the full path of a command in Ubuntu

     

    If you’re writing scripts or making cron jobs you will need to know the full path of the commands you’re using; rather than just being able to use “ls” you would have to use “/bin/ls” instead. You could use the find command here but there’s a quicker and more elegant way: which. Use it like so:

     

    which ls

     

    will return:

     

    /bin/ls

     

    Not everything will be in /bin, e.g.:

     

    which timeout

     

    will likely return:

     

    /usr/bin/timeout

     

    Simple but it will make your life quite a bit easier when writing scripts, particularly with new commands or command which you don’t use often.