From Gentoo Wiki
Jump to: navigation, search

External resources

GNU nano is an easy to use text editor with additional functionality. nano is Gentoo's default editor, means, it is part of each installation. But you can replace it without problems with any other editor.


Install app-editors/nano:

USE flag (what is that?) Default Recommended Description
debug No No Enable debug messages and assert warnings. Note that these will all be sent straight to stderr rather than some logging facility.
justify No Enable justify/unjustify functions for text formatting.
magic No Add magic file support (sys-apps/file) to automatically detect appropriate syntax highlighting
minimal No No Disable all fancy features, including ones that otherwise have a dedicated USE flag (such as spelling).
ncurses Yes Add ncurses support (console display library)
nls Yes Add Native Language Support (using gettext - GNU locale utilities)
slang No Add support for the slang text display library (it's like ncurses, but different)
spell Yes Add dictionary support
unicode Yes Add support for Unicode
root #emerge --ask nano


First steps

Start nano by typing in your terminal nano followed by options. The most common option is a file name and path, e.g.:

user $nano filename

Nano now shows the content of the text file and you can edit the file. Navigate through the text with the arrow keys.

At the bottom nano shows shortcuts for common actions, e.g. save or exit. The shortcut to save is shown as "^O". You have to prefix the shortcut with the Ctrl key, so to save press Ctrl+O. To exit press Ctrl+X.

To edit configuration files always use the -w option. Without that option long lines are wrapped and, when saving, are saved wrapped. This breaks your config files.

To see an overview over all options run nano --help.

Cut, Copy and Paste

You can cut a line with the shortcut Ctrl+K (copy with Alt+^) and paste it with Ctrl+U. To cut / copy multiple line also press the shortcut multiple times.


Search the text with Ctrl+W. Continue the search with Alt+W.

More shortcuts

Action Shortcut Other shortcut
Show the help Ctrl+G F1
Close file Ctrl+X F2
Save file Ctrl+O F3
Search text Ctrl+W F6
Continue search Alt+W F16
Copy line to clipboard Alt+^ Alt+6
Cut line to clipboard Ctrl+K F9
Paste line from clipboard Ctrl+U F10


Set options permanently in the /etc/nanorc. This configuration applies system wide to all users. To change an options only for one user, set the option in the user's ~/.nanorc. It overrides system wide settings.