How to Change the Default Text Editor in Linux VPS

A default text editor comes with respective Linux distributions. Such as nano, vim, ed etc. You can change it according to their preferences by changing the $EDITOR environment variable.

Changing default editor from nano to vim

You must open the .bashrc file and append the line as shown below.

#FILE: .bashrc
export EDITOR=”vim”

Different command line applications alike the crontab, svn and visudo make use of the $EDITOR variable to choose the default text editor.

How to change default text editor in Ubuntu

In an operating system such as Ubuntu, you need to use a script inorder to change the default text editor known as the update-alternatives. Below is the description of how you can go about doing it.

Open a terminal and enter the below command:

$ sudo update-alternatives –config editor

You may also do this by logging in as root to avoid using sudo to run the command. You then be prompted for password, entering the correct password you would be presented with a list of console text editors found on your system. You may choose between them and change it to using as a default text editor.

[sudo] password for yourserver : *****

There are 3 alternatives which provide `editor’.

Selection Alternative

1 /usr/bin/vim.tiny
2 /bin/ed
*+ 3 /bin/nano
Press enter to keep the default[*], or type selection number: 1

Furthermore, you may change the default text editor and apply it all across the system (for all users) or choose to change it for a particular user. Following is the procedure for the two :

A. System Wide

Run the following command and choose the one of your choice

$ sudo update-alternatives –config editor

B. User Level

If you are a user with limited privileges or a server admin who only wishes to change the text editor for particular users, you can add an alias for editor to for example vim.

For that purpose, you must Open and edit ~/.bashrc with adding alias editor=vim

You may test it now. Once you open a bash prompt, you would see the editor has changed according to your preference.

  • Linux VPS, VPS, Linux, Text Editor, Linux Text Editor, VPS Text Editor, Linux VPS Text Editor
  • 21 Bu dökümanı faydalı bulan kullanıcılar:
Bu cevap yeterince yardımcı oldu mu?

İlgili diğer dökümanlar

Ubuntu and PHP 5 “mcrypt extension is missing” error

After installing lamp-server or the individual php5-mcrypt package, you may come across the...

How to Redirect IP to Domain Name using .htaccess

It is important for the SEO to resolve your website and IP address to the same URL and duplicate...

Can I manually create backups / snapshots ?

  Yes, we can enable SolusVM Quick Backups for your OpenVZ VPS. Please request this feature...