Earlier today I’ve been tasked to do something that was long gone on my memory. This is building cron jobs on a CentOS server. Creating cron scripts has been easy since I am only tasked on visiting a specific lnik, and the schedule for cron is made by readily available tools you could find up on the internet.
However, it became time consuming when the default editor is set to vim. Or at least that was vim as far as I know. For a breif moment, I was confused. How to save, how to exit, literaly the whole thing. If I get lost, I just simply close the terminal. Gladly I remembered an editor which was default on another environment I’ve set up before. Here, is where the nano editor comes in.
Based on its web page, GNU nano is a text editor for Unix-like computing systems or operating environments using a command line interface.
So to swith to nano editor, you could simply do the following in a terminal:
export VISUAL=nano;
After setting that, running a crontab -e
will automatically open it on a nano editor.
Other sequence could also be through:
export VISUAL=nano; crontab -e
Of course, if you ever need to go back to vim, you could simply set the VISUAL to vim just like this example below:
export VISUAL=vim; crontab -e
It’s not really much but I hope this could be of help to others as well. As ths is something that I did not stumble upon by myself, here is the guide that helped me came through this awesome rediscovery: https://www.garron.me/en/bits/specify-editor-crontab-file.html
Discussion about this post