What is Pico?
On this page:
Based on the Pine message composition editor, Pico is a simple, display-oriented text editor for Unix. Although less powerful than programs such as vi and Emacs, Pico's basic feature set makes it easier for beginners to learn and use. To add text, just type it in, and it immediately becomes part of the document. You can also use the arrow keys to move about the document. Following is a brief overview of working with files in Pico.
Creating or editing a file
To create a new file or edit an existing one, at your Unix shell prompt, type:pico filename
filename with the name of the file you want to
create or edit. For example, to create a file and name it
If the file already exists, Pico opens it for you to edit. If it doesn't exist yet, Pico creates it and places you in an editing buffer.
Pico displays a menu bar of commonly used commands at the bottom of the screen. Pico accepts commands from your keyboard, but not from your mouse. The following are some of Pico's basic operations:
Inserting text: To insert text into your Pico
editing screen at the cursor, just begin typing. Pico inserts the text
to the left of the cursor, moving any existing text along to the
right. Each time the cursor reaches the end of a line, Pico's word
wrap feature automatically moves it to the beginning of the next
line. (Also see Justifying text below.)
Cursor movement: To move the cursor, use the arrow
keys or use the following commands:
Moves the cursor forward one character
Moves the cursor backward one character
Moves the cursor down to the next line
Moves the cursor up to the previous line
Note: See the Command overview for more cursor movement commands.
Deleting text: To delete the character to the
left of the cursor, press
Ctrl-h. To delete the character highlighted by the cursor, press
Ctrl-d. To delete the current line, press
Saving your work: To save your edited file to
Ctrl-o. Pico displays the current filename. (To save the file under a different name, delete the filename that Pico displays and type a new one.) Press
Exiting Pico: To exit Pico, press
Ctrl-x. If you made any changes since the last save, Pico will ask whether or not to save them. Type
y(for yes) or
n(for no). If you type
y, Pico displays the filename. (To save the edited file under a different name, delete the filename and type a new one.) Press
Searching for text: Pico lets you search forward
from the current cursor position for any text string you
Ctrl-w(for whereis) to invoke the search. Pico will prompt you for a search term. Type the text you're looking for and press
Enter. Pico will move the cursor to the first instance of the text string you entered. You can find additional occurrences by pressing
Justifying text: As you
type, Pico's word wrap automatically begins a new line when
needed. However, when you edit existing text, you may create text
lines that are either too short or too long. To re-wrap (i.e.,
justify) a paragraph, move the cursor to that paragraph and press
Ctrl-j. To undo this action and restore the paragraph to its original condition, press
Cut and paste functions: To cut and paste text
lines with Pico, first place the cursor on the text line you wish to
cut and press
Ctrl-kto remove it. To cut and paste two or more consecutive text lines, press
Ctrl-kuntil all the text lines are removed. Then move the cursor to the location where you want to paste the text and press
Ctrl-u. Pico will paste the text back into the file at the new cursor position.
You can also cut and paste text blocks. To do so:
- Move the cursor over the first character of the text you want to
remove, and then press
Ctrl-Shift-6) to set the mark.
- Use the arrow keys to highlight the text you wish to cut, and then
Ctrl-kto cut the text. Be sure you got all of the text you wanted, including the last character.
- Move the cursor to the place where you want to insert the text,
and then press
Ctrl-uto paste the text into the new position.
- Move the cursor over the first character of the text you want to remove, and then press
Inserting an existing text file: To insert the
contents of an existing file at the cursor location, press
Ctrl-r. Pico will prompt you for a filename. Either type the filename and press
Enter, or press
Ctrl-tto select from a list of available files. Pico will enter the File Browser, which displays a list of files in your current working directory. Use the arrow keys to highlight the file you wish to insert and press
Enter. Select the parent directory (..) to move up the directory tree. Select a subdirectory to move down the directory tree.
Besides inserting text, you can use the File Browser to rename, delete, or copy any file, even a file in another directory. To exit the File Browser, press
Spell checking: To use the spell checker, press
Ctrl-t. When Pico discovers a word it does not recognize, it will highlight the word and prompt you to enter a replacement. You can type a replacement or press
Enterto keep the original word. Pico then continues to the next misspelled word. When Pico has checked your entire document, it will return the cursor to its original position.
Recovering your work: If your Pico session
crashes, Pico will attempt to save a copy of the file you were working
on. Look in your working directory for a filename with the extension
The following list contains most of the commands you'll need to work with Pico:
||Move forward one character.|
||Move backward one character.|
||Move to the previous line.|
||Move to the next line.|
||Move to the beginning of the line.|
||Move to the end of the line.|
||Move forward one page.|
||Move backward one page.|
||Delete the character at the cursor position.|
||Insert a tab at the cursor position.|
||Mark or unmark the beginning of a block of text.|
||If a block of text has been selected with a mark, cuts the entire block. Otherwise, cuts the current line.|
||Paste at the cursor position the last text cut.|
||Redraw the screen.|
||Search for text.|
||Justify the current paragraph.|
||Start the spell checker.|
||Report the cursor position.|
||Read a file into the document at the cursor position.|
||Save the file (without exiting Pico).|
||Exit Pico, giving you the option to save the file.|
For more information, read Pico's man page. To do so, at the Unix prompt, enter:man pico
At Indiana University, for personal or departmental Linux or Unix systems support, see At IU, how do I get support for Linux or Unix?
Last modified on June 20, 2012.