In most of the Linux distribution the defalut editor is set to “VI” and it’s very much popular editor too. But the strange in Ubuntu the default editor is “nano”. But most of the people are well in using vi editor. Here in this post I am going to show how to change the default editor in ubuntu(ie nano) to vi editor

To do this we have to sudo or login as root. and execute the below command.
$sudo update-alternatives –config editor

When you execute above command it will show all the editors installed in your machine, and it ask you to set the default editor by specifying number.

There are 4 choices for the alternative editor (providing /usr/bin/editor).Selection Path Priority Status
————————————————————
* 0 /bin/nano 40 auto mode
1 /bin/ed -100 manual mode
2 /bin/nano 40 manual mode
3 /usr/bin/vim.basic 30 manual mode
4 /usr/bin/vim.tiny 10 manual mode
Press enter
to keep the current choice[*], or type selection number:
Here I want to change it to vi edioter so just enter 3 to set it as a default editor.
Here is my clipped output how I did
update-alternatives –config editor

There are 4 choices for the alternative editor (providing /usr/bin/editor).Selection Path Priority Status
————————————————————
* 0 /bin/nano 40 auto mode
1 /bin/ed -100 manual mode
2 /bin/nano 40 manual mode
3 /usr/bin/vim.basic 30 manual mode
4 /usr/bin/vim.tiny 10 manual mode
Press enter to keep the current choice[*], or type selection
number: 3
update-alternatives :
using /usr/bin/vim.basic to provide /usr/bin/editor (editor) in manual mode.