By default, the editor for the crontab on the Raspberry Pi is the editor specified by the VISUAL or EDITOR environment variables. If neither environment variables is defined, the default editor at /usr/bin/editor is used. On the Raspberry Pi, sometimes even if you have already set the values of VISUAL and EDITOR to your expected editor, for example, vi, default editors such as nano may still be used instead.

To fix this, first check the current editor:

As the current editor is soft linked to /etc/alternatives/editor, we’re going to check this further:

Clearly, the nano editor is used. Now we will update the editor to Vi using the following command:

There are three choices for the alternative editor:

Press ENTER to keep the current choice (marked with *), or type the selection number such as 3 to choose vim.tiny as the default editor.

You can verify that the changes have been made by using:

The result should be:

With this, the default editor for the crontab with sudo should be vi.

Change default crontab editor in bash shell for Raspberry Pi
Share This

Subscribe To Our Newsletter

Join our mailing list to receive the latest news and updates from our team.

You have Successfully Subscribed!

Subscribe

To download the latest tutorials

You have successfully download

Enter Email To Download

Join our mailing list to receive the latest Application for free from IoTBreaks.

You have Successfully Subscribed!

flash Raspbian to SDCard

Enter Email To Download

Join our mailing list to receive the latest Application for free from IoTBreaks.

You have Successfully Subscribed!

Subscribe To Our Newsletter

Join our mailing list to receive the latest news and updates from our team.

You have Successfully Subscribed!