osob.de Unicorn Logo
Blogpost overview

How to Change the Default Editor for crontab -e from Vim to Nano | 12.12.2023

To change the default editor for crontab -e from Vim to Nano, you need to set the EDITOR environment variable to nano. There are a few ways to do this:

You like what you find here? A donation helps to keep this project running.

1. Temporary Change (For Current Session Only) via exported variable

This command sets Nano as the editor for the duration of the terminal session. Once you close the terminal, the setting will revert.

2. Permanent Change via profile

To make Nano the default editor permanently, you need to add the setting to your shell's configuration file.

This change will make Nano the default editor for all future terminal sessions. After applying one of these methods, Nano will be used as the default editor when you run crontab -e.

3. Using the select-editor Command (Debian-based Systems)

Some Linux distributions (especially Debian-based ones) include a utility called select-editor.

4. Using the update-alternatives Command (Debian-based Systems)

On Debian-based systems, you can use update-alternatives to set the default editor for all users.

5. Setting the VISUAL Environment Variable

Similar to EDITOR, the VISUAL environment variable can also be set to your preferred editor.

6. Configuring the Default Editor Directly for Cron (Cron Configuration File)

Some cron implementations allow setting the default editor directly in the cron configuration file. This is less common and depends on the specific cron daemon you are using.