Nano: The Beginner-Friendly Terminal Editor

Nano is what you reach for when you don’t want to think about an editor. It’s modeless — you open a file, you type, you save, you exit. Every command is listed at the bottom of the screen. You don’t need a tutorial.

Open a file

nano file.txt
nano /etc/nginx/nginx.conf       # edit a system file (with sudo)
sudo nano /etc/hosts

The 6 commands you need

The bottom of the nano screen always shows shortcuts. ^ means Ctrl. M- means Alt (or Esc twice).

Ctrl+O    write (save) — Enter to confirm filename
Ctrl+X    exit
Ctrl+W    search
Ctrl+    search and replace
Ctrl+K    cut current line
Ctrl+U    paste (uncut)
Ctrl+G    show all shortcuts (help)

Move around

Arrow keys work. Plus:

Ctrl+A    start of line
Ctrl+E    end of line
Ctrl+Y    page up
Ctrl+V    page down
Ctrl+_    go to line number (then type the number)

Edit selectively

Ctrl+^    start a selection (then move with arrows)
Ctrl+K    cut the selection
Ctrl+U    paste it
M-6       copy without cutting

A nicer ~/.nanorc

Nano’s defaults are fine. If you want syntax highlighting and line numbers:

# ~/.nanorc
set linenumbers
set tabsize 4
set tabstospaces
set autoindent
set mouse
include "/usr/share/nano/*.nanorc"

When nano is the right choice

  • Quick edits over SSH on a server you don’t maintain regularly.
  • One-off config tweaks where you don’t want to think about a tool.
  • Helping a colleague edit a file via screen-share — they can read the bottom of the screen.
  • Embedded systems where vim isn’t installed.

When to graduate to vim

If you spend hours a day in the terminal, vim’s investment pays off. If you edit a file every few weeks, nano is fine forever. There is no shame in nano.

One catch: even if you’re a devoted nano user, learn survival vim. Some tools (visudo, git rebase -i) open vim by default. Knowing :wq and :q! in vim will save you when nano isn’t an option.

What to learn next

Now that you can edit files, the next nodes cover the shell itself: PATH, environment variables, and how to chain commands together.

Similar Posts

Leave a Reply

Your email address will not be published. Required fields are marked *