How to use nano or vim as editor for CronTab

How to use nano or vim as editor for CronTab

If you want to use an editor, when opening CronTab file. And not just use the default for your system. You must need to use VISUAL environment variable.

Export the value of VISUAL and then run crontab -e command.

Specify nano as the editor for crontab file

export VISUAL=nano; crontab -e

If you don’t have installed nano editor then you can install nano with these commands:

Centos:

yum install -y nano

Ubuntu:

apt-get install nano -y

Specify vim as the editor for crontab file

export VISUAL=vim; crontab -e

Of course you need to have vim or nano installed in your system if you want to use them.

COMMENTS