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?

4
  • 1
    Put it in your .bashrc.
    – muru
    May 16, 2017 at 7:16
  • @DavidFoerster Certainly looks like a dupe but the accepted answer in the question you have linked is pretty bad: a simple link to a pretty messy Ubuntu wiki page?
    – andrew.46
    May 16, 2017 at 22:53
  • @andrew.46: Look at the next answer with more than the quadruple amount of votes then. :-) May 17, 2017 at 8:13
  • @DavidFoerster Fair enough :)
    – andrew.46
    May 17, 2017 at 9:27

2 Answers 2

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:

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.

Not the answer you're looking for? Browse other questions tagged .