Back to the command reference

nano

EditorsBeginnerReference only

A simple, beginner-friendly editor

Name: nano: smaller than the pico editor it cloned

This command is outside what the site lets you practise (mostly distribution-specific or rarely used tools). This page describes how to use it; try it on your own Linux system.

Description

nano is a simple terminal editor: you can type straight away and the main shortcuts are listed at the bottom (^ means Ctrl). It is the default editor on many distributions and ideal for quick config edits.

Syntax

nano [OPTION]... [FILE]

Common options

Ctrl+OSave
Ctrl+XExit
Ctrl+WSearch
Ctrl+\Find and replace
Ctrl+K / Ctrl+UCut line / paste
Alt+U / Alt+EUndo / redo
Ctrl+_Go to a line number
-l / --linenumbersShow line numbers (a command-line option)

Examples

  • $ nano notes.txt

    Edit a file; shortcuts are shown at the bottom

    Explain
  • $ sudo nano /etc/hosts

    Edit a system file

    Explain

Related