Skip to: Site Navigation

Linux Tutorial 2

Using Nano Editor in Linux

What is Nano?

Nano is a file editor used in Linux. It is invoked by the command nano filename, where filename is replaced with the name of your file.

Editing commands are invoked by control key sequences. Several menu-like status lines at the bottom of the screen show which commands are active at any given time. Key strokes that do not constitute control key sequences are entered as text at the current cursor position.

Cursor Movement:

You can move your cursor by using the arrow keys; you may also use any of the following editing commands:

Ctrl-a
Beginning of current line

Ctrl-e
End of current line

Ctrl-v
Forward one screen

Ctrl-y
Backward one screen

Ctrl-f
Forward a character

Ctrl-b
Backward a character

Ctrl-p
Previous line

Ctrl-n
Next line

Saving a File:

You can save the file you are working on by using the Ctrl-o (write out) command. If you exit by using the Ctrl-x (exit) command, you will be given a chance to save the file.

Deleting Text:

Ctrl-d
Delete the character the cursor is on

Ctrl-e
Delete to end of current line

Ctrl-k
Delete the line the cursor is on

Ctrl-u
Restore the last line that was deleted

Cutting and Pasting:

You can mark text for cutting and pasting by using the Ctrl-^ command. After entering this command, move the cursor to highlight the text you wish to cut. Use Ctrl-k (Cut) to cut the text. Then use Ctrl-u (Uncut) to paste it.

Searching:

You can search for a given text by using the Ctrl-w command. The search is NOT case sensitive. After entering the command, you will be prompted for the text for which you want to search. If you press Enter at this point, Nano will repeat the last search. All searches start at the current cursor position and wrap around to the beginning of the file.

To move to the last line in the file, type Ctrl-w (where is), Ctrl-v (last line). To move to the first line of the file type Ctrl-w (Whereis), Ctrl-y (first line).

Spell Checking:

Nano includes an spell check function which can voked with Ctrl-t. It will flag words it cannot find and give you a chance to edit them, but will not suggest a correct spelling or allow you to customize the dictionary. You can also use ispell, a more sophisticated spell checker, on any file. At the command prompt, type ispell filename , where "filename" is the name of the file you want to spell check.

Command Line Options:

The following command line options are available for use when Pico is invoked (e.g. pico -w filename):

-w
Disables word wrapping

+x
(x is an integer) Starts the cursor x lines into the buffer

-nx
(x is an integer) Checks your mailbox every x seconds and notifies you if you have new mail.

Miscellaneous:

Ctrl-c will report the current cursor position in the buffer by both line number and character at the bottom of the screen.

Read a file into nano with Ctrl-r and write one from pico with Ctrl-o. After either of these commands, you can enter Ctrl-t (list files) to invoke the file browser. The file browser will allow you to step through the directory structure, see a listing of all files in a given directory, copy files, rename files, and delete files.

Edited from: http://www.uic.edu/depts/accc/software/pine/pico.html

Top

Copyright ©2007-2008 by Kevin Miller, Jr. All Rights Reserved.
Web site URI: http://ais.saigonnezumi.com
Validate me: XHTML 1.1 | CSS | Section 508 | Lynx | Contact Mr. Kevin