Text Editing with Pico or Nano


Introduction

On the Classes server, 'pico' is really just a link to 'nano'. They both call the same program. When you start it, you'll see "GNU nano " at the top of the screen. Nano is an open source version of Pico developed for GNU/Linux (whereas Pico is a Unix program).

Nano is designed to be easy to use, but is much less powerful than Vim. You can simply edit text directly and use the shortcuts at the bottom of the screen for basic operations. Activate a shortcut by holding Ctrl and pressing the letter associated with it. The shortcuts are summarized in Nano at the bottom of the screen and listed just below. They appear with capital letters, but work as lower case letters.

Ctrl+X    Exit (quit Nano)

Ctrl+O    Write Out (save your file)

Ctrl+R    Read File (inserts lines from a file into your document)

Ctrl+W    Where Is (a find command)

Ctrl+\    Replace (find and replace)

Ctrl+K    Cut Text (delete a whole line and copy it to Nano clipboard)
                   (repeating this erases whatever is on the clipboard)

Ctrl+U    Uncut Test (paste a line from the Nano clipboard at the cursor)

Ctrl+J    Justify (word wrap the current line, inserting line breaks)
                  (Ctrl+U undoes justify until you press any key)

Ctrl+T    To Spell (spell checker; not available on our server)

Ctrl+C    Cur Pos (reveals current line; useful for navigation)

Ctrl+_    Go to Line (type line number and press enter)

If you need more help with Nano, talk to your instructor. If you're feeling adventurous, I recommend trying Vim instead.

Recovering from a Crash

If you close Putty (or your laptop/PC crashes while you were working) Nano will automatically save your open file in filename.save. So if you're working on prog1.c, there will be a prog1.c.save file containing your unsaved work. You can use the save by simply renaming it with mv command back to just prog1.c and opening it in Nano. Note that this would overwrite your last normal save of prog1.c. If you'd like to keep a copy of that, rename prog1.c FIRST to something else such as prog1.c.old.