optics.csufresno.edu Class Files - ECE 71 HOWTOs
Department of Electrical and Computer Engineering
Dr. Gregory R. Kriehn, Professor

HOWTO Use the Text Editor nano

Using nano

nano is a simple text-based editor that we will be using on the Linux server (ezekiel) to develop source code for our C programs. To launch it, first make sure you are logged into ezekiel using PuTTY, and then launch nano from the command prompt:

~> nano [filename.c]

The [filename.c] option provides the name of the file that you would like to edit or create. For instance, to create and edit a text file called "text.txt", type:

~> nano text.txt

This will launch the program. On the bottom two rows of the screen, you will notice the following:

^G Get Help  ^O WriteOut  ^R Read File ^Y Prev Page ^K Cut Text  ^C Cur Pos
^X Exit      ^J Justify   ^W Where Is  ^V Next Page ^U UnCut Text^T To Spell

The "^" character means "Hold Down the Control (Ctrl) Key" while pressing one of the other letters. For instance, to exit, you would type "^X" (Ctrl-X), meaning that you should hold down the Control Key and then press "x".

There are a number of useful commands that you need to know about in nano:

^O (Ctrl-o)   =   Save File
^C (Ctrl-c)   =   Current Line Number
^K (Ctrl-k)   =   Cut a Line of Text
^T (Ctrl-t)   =   Spell Check
^U (Ctrl-u)   =   Uncut Text
^W (Ctrl-w)   =   Search for a Text Word/String
^X (Ctrl-x)   =   Exit

For instance, after you have written some text, you can save it by pressing "^O", typing the name of the file that you want to save, and then hitting Enter. Pressing "^X" will subsequently exit the program.

Please note that you can move around the cursor with all four Arrow Keys, the Page Up and Page Down Keys, and the Home, End, and Delete Keys. Spend some time familiarizing yourself with the program. Then Save your file and Exit.