Writing

How to set or change default text editor for crontab in Linux?

Written in 2017 and kept as it was. Commands and console layouts may have changed since.

CrontabTo edit the crontab entries you use crontab -e. The command will check for the environment variables $EDITOR or $VISUAL.

So you need to set the  $EDITOR or $VISUAL variable. Let’s learn how to do that.

To Set the default editor to (Vim) for crontab editing

$ export VISUAL=vim

or

$ export EDITOR=vim

Then
$ crontab -e

To set the default editor to (nano) for crontab editing

$ export VISUAL=nano

To set the default editor to (ed) for crontab editing

$ export VISUAL=ed

to exit from ed you need to type q and press enter.

This is how you can set the default editor for crontab in linux.