On Unix-like operating systems, pico is a simple text editor in the style of the pine e-mail composer.

Description

Pico (available on modern Linux systems as nano) is a simple, display-oriented text editor. Commands and their Control key shortcuts are displayed at the bottom of the screen. As characters are typed, they are immediately inserted into the text.

On modern Linux systems, nano (the GNU version of pico) is installed by default. It’s identical to pico. In all the commands listed here, you can use “nano” instead of “pico” on Linux.

  • Description
  • Syntax
  • Examples
  • Related commands
  • Linux commands help

Editing commands are entered using Control key shortcuts. As a workaround for communications programs that swallow certain control characters, you can emulate a control key by pressing Escape twice, followed by the desired control character. For example, “Esc Esc c” would be equivalent to entering a ctrl-c. The editor has five basic features: paragraph justification, searching, block cut/paste, a spelling checker, and a file browser.

Paragraph justification (or filling) takes place in the paragraph containing the cursor, or, if the cursor is between lines, in the paragraph immediately below. Paragraphs are delimited by blank lines, or by lines beginning with a space or tab. Unjustification can be done immediately after justification using the control-U key combination.

String searches are not sensitive to case. A search begins at the current cursor position and wraps around the end of the text. The most recent search string is offered as the default in subsequent searches.

Blocks of text can be moved, copied or deleted with creative use of the command for mark (ctrl-^), delete (ctrl-k) and undelete (ctrl-u). The delete command removes text between the “mark” and the current cursor position, and place it in the “cut” buffer. The undelete command effects a “paste” at the current cursor position.

The spell checker examines all words in the text. It then offers each misspelled word for correction while highlighting it in the text. Spell checking can be canceled at any time. Alternatively, pico will substitute for the default spell checking routine a routine defined by the SPELL environment variable. The replacement routine should read standard input and write standard output.

The file browser is offered as an option in the “Read File” and “Write Out” command prompts. It is intended to help in searching for specific files and navigating directory hierarchies. File names with sizes and names of directories in the current working directory are presented for selection. The current working directory is displayed on the top line of the display while the list of available commands takes up the bottom two. Several basic file manipulation functions are supported: file renaming, copying, and deletion.

Syntax

pico [ options ] [ file ]

Options

When a running pico is disconnected (i.e., receives a SIGHUP signal), pico saves the current work if needed before exiting. Work is saved under the current file name with “.save” appended. If the current work is unnamed, it is saved under the file name “pico.save”.

Examples

pico myfile.txt

Launches the pico editor, and opens the file myfile.txt for editing.

ed — A simple text editor.emacs — A highly extensible text editor.ex — Line-editor mode of the vi text editor.pine — A client for using mail and newsgroups.vi — Text editor based on the visual mode of ex.vim — An advanced version of vi.