Skip to the content of the web site.

Basic File Editing (pico)

Contents Previous Topic Next Topic

The simplest (and one of the smallest) Unix editor is pico. It is similar to the Windows Notepad editor.

(Note: If you are going to do most of your development on Unix, you may look into a more serious editor, such as gvim or emacs, however, if you are making simple changes and you feel that you do not have sufficient time learn another editor, pico should satisfy your needs.)

To edit a file, simple type pico and enter the file name.

{eceunix:1} pico filename

Trick: if the file exists, you can use filename completion. For example, suppose there exists a file named filename. You can type pico fi and then press Tab. The tcsh will see if there is a unique file starting with fi. If so, it will replace fi with the full file name.

Once you are using editors, the commands are all accessed using control characters. For example, Ctrl-G (or ^G) displays the help page, which contains, among other information, the following commands shown in Table 1 which is taken, in part, from the pico help system.

^GF1display this help text.
^F Move Forward a character.
^B Move Backward a character.
^P Move to the Previous line.
^N Move to the Next line.
^A Move to the beginning of the current line.
^E Move to the End of the current line.
^VF8Move forward a page of text.
^YF7Move backward a page of text.
^WF6Search for (Where is) text, neglecting case.
^L Refresh the display.
^D Delete the character at the cursor position.
^^ Mark cursor position as beginning of selected text.
Note: Setting mark when already set un-selects text.
^KF9Cut selected text (displayed in inverse characters).
Note: The selected text's boundary on the cursor side ends at the left edge of the cursor. So, with selected text to the left of the cursor, the character under the cursor is not selected.
^UF10Un-cut (paste) last cut text inserting it at the current cursor position.
^IF4Insert a tab at the current cursor position.
^JF4Format (Justify) the current paragraph.
Note: paragraphs delimited by blank lines or indentation.
^TF12To invoke the spelling checker.
^CF11Report current Cursor position.
^RF5Insert an external file at the current cursor position.
^OF3Output the current buffer to a file, saving it.
^XF2EXit pico, saving buffer.

When you start pico you will see the most common functions summarized at the bottom of the page. This is demonstrated in Figure 1 which shows pico editing the file SingleList.h.

Figure 1. Screen shot of pico editing the file SingleList.h.

To view more information about pico, please visit Wikipedia.

Contents Previous Topic Next Topic

Copyright ©2005-2007 by Douglas Wilhelm Harder. All rights reserved.