Changing the Default Text Editor in Linux

Changing the Default Text Editor in Linux

By default, CentOS / RHEL 5.x ships with VIM as the default text editor. However if you prefer a different text editor you can easily modify the default text editor by changing the VISUAL environment variable.

Locate Favorite Text Editor:

# whereis nano
nano: /usr/bin/nano /usr/share/nano /usr/share/man/man1/nano.1.gz

Set the VISUAL environment:

export VISUAL=”/usr/bin/nano”

In this example, exporting the VISUAL environment variable will change the default editor to nano (with -w) for the remainder of your session. Once you log out the default editor, vim, will be back.

To make the change permanent, you need to modify one of the two following files:

/etc/profile (for all users)
~/.bash_profile (for only your user)


LEAVE A COMMENT