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

To 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.

 

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.