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?
Asked
Active
Viewed 1.5k times
8
-
1Put it in your `.bashrc`. – muru May 16 '17 at 07: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 '17 at 22:53
-
@andrew.46: Look at the next answer with more than the quadruple amount of votes then. :-) – David Foerster May 17 '17 at 08:13
-
@DavidFoerster Fair enough :) – andrew.46 May 17 '17 at 09:27
2 Answers
13
A couple of easy steps should see you through:
- Log into your account using ssh
- Open the file
~/.bashrcwith a text editor Add something like the following:
export EDITOR='/usr/bin/nano'Save the file (and adjust the path to nano if you have it in a non-standard location)
Either log out and back in again or simply type:
source ~/.bashrc
And then you should be set :).
References:
andrew.46
- 37,085
- 25
- 149
- 228
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,363
- 6
- 31
- 44