Linux Tips 14: Changing the default cron editor to vim

For some reason a lot of servers I work with have set up the default cron editor, the one that is launched using crontab -e, to nano. As a long time vim user I find nano to be too slow and strange for quick editing. Therefore I found the need to set up the account to use vim instead. To enable vim for use in crontab is easy, simply execute the following line at the command prompt:

export VISUAL=vim

You can check that it worked using the command env The output of env should show VISUAL=vim if the export command was executed successfully, alternatively you can just execute crontab -e to see which editor loaded. If you want the setting to be set all the time you need to add the line to your .bashrc or .bash_profile, depending on your *nix distro.

Please note that you can also use any other editor that can be launched from the command line. Just replace vim with your editor of choice.


Post a Comment