skey - web developer

Edit crontab with NANO

by on

Cron jobs

I don’t know where my root users crontab file is, and this doesn’t usually matter because using the command crontab -e opens it for editing anyway. The problem is that it opens in VI and I'm younger generation which never used VI magic wand and I don't want to spend few hours/days just to be able to make changes in file. My favourite editor in unix systems is nano. The -e switch makes the file open in whatever the default editor for the environment is. To override VI, we will pass the EDITOR environment var to the command when I run it:

    sudo env EDITOR=nano crontab -e

The other way is to set value of VISUAL and then run the crontab like this:

    export VISUAL=nano; crontab -e

That's my magic bit for today. Hope it helps you too. :)