This article explains how to change the text editor that is used by default in the Linux command-line environment.

Setting the default text editor

You can change the default command-line text editor used by various programs, such as crontab. For instance, a lot of accounts are set up to utilize nano as their primary text editor. Vi should be the default editor, though, if you are more comfortable using it.

Take these actions to modify the default command-line text editor.

  1. Log in to your account using SSH.
  2. Open the .bashrc file in your preferred text editor.
  3. Add the following lines to the .bashrc file. Replace both occurrences of program with the editor you want to set as the default editor:

           export EDITOR='program'

       export VISUAL='program'

     4. Save the changes to the .bashrc file and exit the text editor.

     5. To make the new default text editor settings take effect, log out of your account and then log back in. Alternatively, you can just type the following command:

       source .bashrc
Was this answer helpful? 0 Users Found This Useful (0 Votes) linux