Nano#

GNU nano is the friendliest terminal editor: no modes, on-screen keybinding hints, drop-in replacement for pico. Default editor on most modern Linux distributions and the fallback in many EDITOR environments.

Why It Exists#

When the prompt asks “edit this file” (a commit message, an SSH known hosts entry, a config) Nano’s job is to be the editor a stranger can use without a tutorial.

Type. Save. Exit. Done.

Cheat Sheet#

The bottom of the screen always shows the keybindings; this is the entire reason a stranger can use Nano without a tutorial. The table below covers the actions you reach for most often; the on-screen panel updates with whatever else is contextually available. ^ means Ctrl.

Keys

Action

Ctrl-O

save (write Out)

Ctrl-X

exit

Ctrl-K

cut line

Ctrl-U

paste (uncut)

Ctrl-W

search (where is)

Ctrl-

search and replace

Ctrl-G

help

Alt-U / Alt-E

undo / redo

Alt-A

mark (start selection)

Ctrl-C

show position

Ctrl-T

spell-check (if available)

If a command needs more than one keystroke, the bottom panel updates to show what’s possible.

Files#

Nano configuration lives in a per-user ~/.nanorc and an optional system-wide /etc/nanorc. Syntax-highlighting definitions ship in /usr/share/nano/; include them from .nanorc to get coloring for the languages you edit.

  • ~/.nanorc, per-user config.

  • /etc/nanorc, system-wide.

  • /usr/share/nano/, syntax-highlighting definitions.

Useful .nanorc Settings#

The defaults Nano ships with are conservative; flipping the options below brings the editor much closer to a modern config-file editor, with line numbers, sane indentation, soft wrap, mouse support, and the cursor position carrying over between sessions:

set linenumbers
set tabsize 4
set tabstospaces
set autoindent
set softwrap
set mouse
set unix             # always save with Unix line endings
set positionlog      # remember cursor position per file

# Syntax highlighting (paths vary by distro)
include "/usr/share/nano/*.nanorc"

Where You Find It#

Effectively everywhere a beginner would go looking. Most desktop Linux distributions ship Nano as the default editor; macOS ships pico (Nano’s ancestor); even Cygwin / MSYS2 / WSL builds on Windows include it for shell users:

  • Default editor on Ubuntu, Debian, and most desktop distributions.

  • Available on every BSD, macOS (via Homebrew), Windows (via Cygwin / MSYS2 / WSL).

  • Often the editor that opens when EDITOR is unset and a tool invokes “the system editor”.

Strengths#

What makes Nano the right answer for “edit this file” prompts on a remote server. Discoverability is the big one; a stranger can sit down in front of Nano and finish a task without knowing anything about the editor.

  • Discoverable, keybindings on screen.

  • No modes, start typing.

  • Tiny binary, always available.

  • Ctrl-X is exit, you can guess what to do.

Weaknesses#

What Nano isn’t trying to be. It is a deliberate small editor for short edits, not a daily coding environment, not a configurable power tool, not an alternative to Vim or Emacs in the sense that those compete with each other.

  • Not for daily coding, no LSP, no fuzzy find, no multi-cursor.

  • Limited customization compared to Vim or Emacs.

  • Mouse support exists but isn’t first-class.

When to Pick Nano#

The default for any quick, throwaway edit and for onboarding anyone who has never used a terminal editor before. Anyone you would otherwise drop into vi first should probably get Nano instead.

  • The prompt asks you to edit something on a server.

  • Onboarding someone who’s never used a terminal editor.

  • Quick, throwaway edits where the goal is “type and save”.

Anyone you’d send to vi first should probably get nano instead.