> ## Documentation Index
> Fetch the complete documentation index at: https://kb.hosting.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Setting the default text editor in Linux

> Learn to set the default text editor in Linux with this step-by-step guide and code snippets.

This article describes how to set the default text editor 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 example, many accounts are configured to use nano as the default text editor. However, if you are more familiar with vi, you may want to use it as the default editor instead.

To change the default command-line text editor, follow these steps:

1. Log in to your account [using SSH](/docs/using-ssh-secure-shell).

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'
   ```

   > 📘 Note
   >
   > * To set vi as the default text editor, replace *program* with *vi*.
   >
   > * To set nano as the default text editor, replace *program* with *nano*.

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:

   ```bash theme={null}
   source ~/.bashrc
   ```

## Related articles

* [Editing text files](/docs/editing-text-files)
