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..
Different command-line users prefer different editors for their daily work. Here I’m explaining the steps to change the default editor selection. The corntab editor command “crontab -e” uses the default file editor to configure cron.
How to change the default editor from command line?
1. Checking current editor:
You can use the aforementioned echo command to check the current editor.
2. Exporting the new editor details:
# export EDITOR=/usr/bin/nano
3. Check if it’s changed:
# echo $EDITOR /usr/bin/nano
4. To set it permanently, please run the following command:
source ~/.profile source ~/.bashrc
That’s it dude!!
Go ahead and set it to yours favorite!!
If you have any questions, please commend here or create a topic here.