8

Every time I SSH into my AWS, I am changing editor to nano. Is there a command to run that will change it to nano for all future instances a well?

Vantage
  • 81

2 Answers2

13

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:

andrew.46
  • 38,003
  • 27
  • 156
  • 232
8

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.

2707974
  • 10,553
  • 6
  • 33
  • 45