LinuxCommandLibrary

pico

Edit text files in the terminal

TLDR

Start the editor

$ pico [path/to/file]
copy

Start the editor with the cursor located n lines into the file
$ pico +[n] [path/to/file]
copy

Start the editor with the cursor shown before the current selection
$ pico -g [path/to/file]
copy

Define the quote string for files such as email
$ pico -Q "[quotestring]" [path/to/file]
copy

Enable mouse functionality when run within an xterm window
$ pico -m [path/to/file]
copy

Set the operating directory for pico
$ pico -o [path/to/directory]
copy

Enable "view only" mode, which disallows any edits
$ pico -v [path/to/file]
copy

Display all files including those beginning with a period
$ pico -a
copy

SYNOPSIS

pico [options] [file...]

Examples:
pico myfile.txt
pico -w config.conf

PARAMETERS

file...
    Specifies one or more files to open for editing. If the file does not exist, a new empty file will be created.

-w
    Disables word wrapping. Long lines will extend off-screen rather than wrapping to the next line.

-v
    Opens the file in view-only (read-only) mode, preventing accidental modifications.

+N,C
    Starts the editor with the cursor at line N and column C (e.g., pico +10,5 myfile.txt). Note: This specific option syntax is more commonly associated with nano.

--help
    Displays a summary of command-line options and exits.

--version
    Displays version information about the pico (or nano) editor and exits.

DESCRIPTION

pico is a lightweight, cursor-based text editor designed for ease of use, originally developed as part of the Pine email client. It stands for "Program for Internet Communications." Unlike more complex editors like Vi or Emacs, pico focuses on simplicity and a low learning curve, making it ideal for quick edits, configuration file modifications, or basic note-taking directly within the terminal.

Its most distinctive feature is the persistent display of common commands at the bottom of the screen, eliminating the need to memorize complex keybindings. Users navigate with arrow keys and perform actions using Control key combinations (e.g., Ctrl+X to exit, Ctrl+O to save). While lacking advanced features found in other editors, pico remains a popular choice for beginners or those requiring a straightforward editing experience on Unix-like systems. On many modern Linux distributions, the pico command is actually a symbolic link to the nano editor, which was created as a free software clone of pico.

CAVEATS

On most modern Linux distributions, the pico command is a symbolic link to the nano editor. This means that invoking pico actually executes nano, and its behavior, features, and command-line options are those of nano.

pico lacks many advanced features found in other powerful editors like Vim or Emacs, including advanced scripting, regular expression search/replace, multiple buffers, and windowing. Its primary strength lies in its simplicity rather than its feature set.

BASIC USAGE & KEY BINDINGS

Inside pico, common operations are performed using Control key combinations, which are conveniently displayed at the bottom of the screen. Some of the most frequently used bindings include:

  • Ctrl+G: Get Help (displays a comprehensive list of commands).
  • Ctrl+X: Exit (prompts to save changes if unsaved).
  • Ctrl+O: Write Out (save current changes to the file).
  • Ctrl+R: Read File (insert contents of another file).
  • Ctrl+K: Cut Text (cut the current line).
  • Ctrl+U: Uncut Text (paste the last cut text).
  • Ctrl+W: Where Is (search for text).
  • Ctrl+T: To Spell (invokes spell checker).

Navigation is typically done using arrow keys.

HISTORY

The pico editor was originally developed by the University of Washington for the Pine (Program for Internet News and Email) email client, first released in 1992. Its design prioritized ease of use and a shallow learning curve, making it accessible to non-technical users within the command-line environment. The name pico itself is an acronym for "Program for Internet Communications."

Due to licensing restrictions associated with the Pine and pico software, a free software clone named nano (Nano's ANOther editor) was created in 1999 to provide an open-source alternative with similar functionality. Over time, nano gained widespread adoption in the Linux ecosystem, and many distributions now provide pico as a symbolic link to nano, effectively replacing the original pico with its open-source counterpart while maintaining command compatibility.

SEE ALSO

nano(1), vi(1), vim(1), emacs(1), cat(1), less(1)

Copied to clipboard