crontab by default opens in vi editor. But many users prefer to use nano editor instead of vi editor. In this tutorial we will learn how to open crontab in nano editor.
How to open crontab editor
Use below command in SSH to open cronab editor.
Default crontab editor
The default crontab editor is vi
Change default crontab editor to nano
Make sure you have nano installed on your system. If it is not installed use below command to install nano
yum install -y nano
Open bash_profile in editor
We are going to set nano as profile’s default editor. So, open .bash_profile file in editor.
Add below line at the bottom of this file.
Save and edit editor using ctrl + o and ctrl + x.
Run below command to reload bash_profile
We have now successfully changed the profile’s default editor. And this will also change the default editor for crontab.
Open crontab and it should now open in nano editor.