Setting permanent export EDITOR to nano for all future sessions [duplicate]

Solution 1:

A couple of easy steps should see you through:

  1. Log into your account using ssh
  2. Open the file ~/.bashrcwith a text editor
  3. Add something like the following:

    export EDITOR='/usr/bin/nano'
    
  4. Save the file (and adjust the path to nano if you have it in a non-standard location)

  5. Either log out and back in again or simply type:

    source ~/.bashrc
    

And then you should be set :).

References:

  • How to set the default text editor in Linux

Solution 2:

To set the default editor using the update-alternatives command. Open up a terminal window and type in the following command:

sudo update-alternatives --config editor

Here’s an example of what you’ll see:

$ sudo update-alternatives –config editor

There are 5 alternatives which provide `editor’.

Selection Alternative
———————————————–
1 /usr/bin/vim
2 /bin/ed
*+ 3 /bin/nano
4 /usr/bin/vim.basic
5 /usr/bin/vim.tiny
Press enter to keep the default[*], or type selection number:

You can select the editor you want by just typing in the number. For example, if I want to change the default editor to vim, I would just hit the number 1.