Setting the default text editor in Linux

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?

Related Articles

How to determine high disk usage locations

This article describes how to determine where your account is using the most disk space....

How to disable e-mail notifications from cron jobs

This article demonstrates how to stop receiving e-mail notifications from cron jobs. By default,...

How to manage the inode count

This article defines an inode count, discusses how to calculate it for your account, and how to...

How to monitor resource usage

This article describes how to monitor resource usage using the top and atop commands. Method 1:...

How to use cURL

This article describes how to use the cURL program to transfer files from the command line. When...