$linuxjunkies
>

nano(1)

nano is a simple, user-friendly terminal text editor for creating and editing files.

UbuntuDebianFedoraArch

Synopsis

nano [OPTION]... [FILE]...

Description

nano is a small, free, and friendly text editor that runs in the terminal. It is easier to use than vi or vim for beginners because it displays keyboard shortcuts at the bottom of the screen. You can open existing files for editing or create new ones.

nano works with plain text files and is commonly used for quick edits of configuration files, scripts, and documents. Changes are held in a buffer until you explicitly save them.

Common options

FlagWhat it does
-wdisable word wrapping; long lines extend off-screen
-lenable line numbers on the left margin
-menable mouse support to click and scroll in the editor
-cshow cursor position (line and column) in status bar
-udisable undo/redo functionality
-vopen file in view mode (read-only, no editing)
-Bcreate backup files with .bak extension before saving
-iindent new lines to match the previous line's indentation

Examples

open or create myfile.txt for editing

nano myfile.txt

edit the hosts file with line numbers displayed

nano -l /etc/hosts

edit a shell script without automatic word wrapping

nano -w script.sh

view config.conf in read-only mode without editing ability

nano -v config.conf

edit notes.txt with mouse support and cursor position indicator

nano -m -c notes.txt

open nano with an empty buffer; use Ctrl+O to save when done

nano

Related commands