# Setting the default text editor in Linux

> Make nano, vi or another editor the default command-line text editor for programs such as crontab.

Source: https://helpcenter.ruachost.com/developers/linux/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:

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 file, replacing `program` with the editor you want as default:

```
export EDITOR='program'
export VISUAL='program'
```

> **Note:**
- To set `vi` as the default editor, replace `program` with `vi`.
- To set `nano` as the default editor, replace `program` with `nano`.

4. Save the changes and exit the text editor.
5. To apply the new settings, log out and log back in, or run:

```
source ~/.bashrc
```
