How to make nano the default editor on the system

How to make nano the default editor on the system,also crontab.

I use MATE desktop. I use Bash

Hi @Snubbi,

I wrote this for someone today. Don’t know if it’ll work, but I’m guessing it will:

Note:
In your case you’d need to replace $BROWSER with $EDITOR.

My $EDITOR if the following:

$ echo $EDITOR
/usr/bin/nano

Hope this helps!

I found this page https://linuxize.com/post/how-to-use-nano-text-editor/ is not the right way to do it?

Add to /etc/environment FILE (for root)
or/and FOR USER to ~/.bash_profile

export EDITOR="/usr/bin/nano"
export VISUAL=$EDITOR

For edit /etc/sudoers with nano you need once edit sudoers config:

sudo -i
export EDITOR=nano
visudo

add at end of file:

## Set nano as default editor
Defaults env_reset
Defaults editor=/usr/bin/nano, !env_editor

Save changes in files.

1 Like

It would be better to leave sudoers untouched and make a config file in /etc/sudoers.d/ name it 20-whatever and add the changes there.

https://wiki.archlinux.org/index.php/Sudo#Configure_sudo_using_drop-in_files_in_/etc/sudoers.d

1 Like