Nano

From SHellium Wiki
(Redirected from Nano:HOWTO)
Jump to: navigation, search
Geographylogo.png In other languages: English | Afrikaans | Albanian | Arabic | Brazilian | Bulgarian | Catalan | Chinese | Croatian | Czech | Danish | Dutch | Esperanto | Estonian | Filipino | Finnish | Flemish | French | German | Greek | Hebrew | Hindi | Hungarian | Indonesian | Italian | Japanese | Latvian | Lithuanian | Macedonian | Malay | Malayalam | Norwegian (Bokmål) | Norwegian (Nynorsk) | Persian | Polish | Portuguese | Romanian | Russian | Serbian | Slovak | Slovenian | Spanish | Swedish | Turkish | Ukrainian | Urdu

Contents

The Nano Text Editor

Nano is small, user friendly replacement for the text editor Pico and is well suited to working on the command line in UNIX. Unlike other editors like Vi, there is no special mode you need to enter in order to type your text. It is not as powerful as GUI editors, as it does not use the mouse, but still has many useful features.

Most nano commands are invoked by holding down the Ctrl key (that is, the control key), and pressing one of the other keys. In this text, the control key is represented by ^. For example, ^X means: hold down the Ctrl key and press the x key. Help is also available inside nano by using ^G. Some commands may use the meta, or alt, key.

Starting nano

To edit a file nano <filename>.

Navigation

The usual mouse-based point-and-click method is not supported by nano. Use the arrow keys to move around the page in nano.

Other navigation commands:

^A move to beginning of line

^E move to end of line

^Y move down a page

^V move up a page

^_ move to a specific line (^_^V moves to the top of the file, ^_^Y to the bottom)

^C find out what line the cursor is currently on

Searching

^W search for some text.

When searching, you will be prompted for the text to search for. It searches from the current cursor position, wrapping back up to the top if necessary.

Editing

Insert new text at the current cursor position just by typing the text in.

^R Insert another file into the current one at the current cursor position

Delete

^D delete character currently under the cursor

BackSpace delete character currently in front of the cursor

^K delete entire line

^\ search for (and replace) a string of characters

Cut and Paste

Note that the cutbuffer holds multiple lines. If multiple lines are cut they will all be pasted back.

^K cut the current line into the buffer

meta^ copy the current line into the buffer (note: meta shift six on a US keyboard)

^U paste the buffer

Saving and Exiting

^O save contents without exiting (you will be prompted for a file to save to)

^X exit nano (you will be prompted to save your file if you haven't)

^T when saving a file, opens a browser that allows you to select a file name from a list of files and directories

Command Line Options

Nano can be opened with a variety of options changing display, colouring, wrapping and behaviour options. The -w (nowrap) can be very helpful.

nano <opt> <filename>

-T <#cols> --tabsize=<#cols> Set width of a tab to #cols column

-U --quickblank Do quick statusbar blanking

-V --version Print version information and exit

-W --wordbounds Detect word boundaries more accurately

-Y <str> --syntax=<str> Syntax definition to use for coloring

-c --const Constantly show cursor position

-d --rebinddelete Fix Backspace/Delete confusion problem

-i --autoindent Automatically indent new lines

-k --cut Cut from cursor to end of line

-l --nofollow Don't follow symbolic links, overwrite

-m --mouse Enable the use of the mouse

-o <dir> --operatingdir=<dir> Set operating directory

-p --preserve Preserve XON (^Q) and XOFF (^S) keys

-r <#cols> --fill=<#cols> Set wrapping point at column #cols

-s <prog> --speller=<prog> Enable alternate speller

-t --tempfile Auto save on exit, don't prompt

-v --view View mode (read-only)

-w --nowrap Don't wrap long lines

-x --nohelp Don't show the two help lines

-z --suspend Enable suspension

Personal tools
Namespaces

Variants
Actions
Navigation
Indexes
SHellium Sites
Toolbox