# How to install nano text editor in Linux (/docs/tutorials/software-installation/how-to-install-nano-text-editor-in-linux)



Nano is a simple, user-friendly command-line text editor for Linux. It is ideal for quick edits to configuration files and is much easier to use than vi/vim for beginners. This article covers installation and basic usage.

## Installation

### Debian / Ubuntu

```bash
sudo apt-get update
sudo apt-get install nano
```

### CentOS / RHEL

```bash
sudo yum install nano
```

### Fedora

```bash
sudo dnf install nano
```

### Verify installation

```bash
nano --version
```

## Typical usage

1. Open a file:

   ```bash
   nano /path/to/file
   ```

   To open a file and jump to a specific line number:

   ```bash
   nano +42 /path/to/file
   ```

2. Make changes. Move the cursor with the arrow keys and type to insert or edit text.

3. Save the file. Press **Ctrl + O**, confirm the filename, then press **Enter**.

4. Exit nano. Press **Ctrl + X**. If there are unsaved changes, nano asks whether to save them.

## Basic keyboard shortcuts

nano uses keyboard shortcuts displayed at the bottom of the screen. `^` means **Ctrl** and `M-` means **Alt**.

| Shortcut   | Action               |
| ---------- | -------------------- |
| `Ctrl + O` | Save (Write Out)     |
| `Ctrl + X` | Exit                 |
| `Ctrl + K` | Cut the current line |
| `Ctrl + U` | Paste                |
| `Ctrl + W` | Search               |
| `Ctrl + \` | Search and replace   |
| `Ctrl + G` | Display help         |
| `Ctrl + C` | Show cursor position |
| `Ctrl + _` | Go to line number    |
| `Alt + U`  | Undo                 |
| `Alt + E`  | Redo                 |

## Configuration file

nano's behaviour can be customised in `~/.nanorc` (per-user) or `/etc/nanorc` (system-wide). Useful settings:

```
set tabsize 4
set autoindent
set linenumbers
set mouse
```

Enable syntax highlighting by including the default highlight files:

```
include "/usr/share/nano/*.nanorc"
```
