How to open crontab in nano editor

crontab

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.

crontab -e

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.

nano ~/.bash_profile

Add below line at the bottom of this file.

export VISUAL="nano"

Save and edit editor using ctrl + o and ctrl + x.

Reload bash_profile

Run below command to reload bash_profile

. ~/.bash_profile

Done!!

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.

crontab -e

Our Top Rated Host

Related Posts