Setting the default text editor in Linux
Setting the default text editor in Linux
Learn how to set the default text editor in the Linux command-line environment with this step-by-step guide.
This article explains how to configure the default text editor for command-line usage.
Setting the default text editor
You can change the default command-line text editor used by programs such as crontab. Many accounts are set to use nano by default, but if you prefer vi or another editor, you can make it the default.
To set the default text editor:
- Log in to your account using SSH.
- Open the
~/.bashrcfile in your preferred text editor. - Add the following lines to the file, replacing
programwith the editor you want as default:
export EDITOR='program'export VISUAL='program'- Save the changes and exit the text editor.
- To apply the new settings, log out and log back in, or run:
source ~/.bashrc