How to change the default editor for crontab?

Does it work? I really wanna to change the editor from nano to vi!!

Crontab is the program used to install, remove or list the tables used to drive the cron daemon. Cronjobs are predefined jobs which are running periodically according to the settings we have done previously. In the /etc folder there is a file called crontab where we can write the command or name of the script that is to be executed at as per our customized time.

The command used to edit the cron configuration file is “crontab.” You can use the “-e” switch along with the command “crontab” to edit the configuration. If it’s for a particular user you can use the “-u” switch to specify the user name. Managing crontab via CLI is not a big task.

Examples are listed below:

# crontab -e

For a particular user:

# crontab -e -u crybit

How to check the default editor in my server?

You can use the echo command to display the default editor on your server. Please see the command pasted below:

# echo $EDITOR

There are different editing tools are available with a default Linux installation, like vi, vim, nano, pico etc..