peco
Filter and select from a list interactively
TLDR
Start peco on all files in the specified directory
Start peco for running processes
Start peco with a specified query
SYNOPSIS
peco [options]
command | peco [options]
PARAMETERS
--query <string> / -q <string>
Starts the interactive filter with an initial pre-filled query string.
--rcfile <file>
Specifies a custom path to the configuration file, overriding the default location.
--layout <layout_name>
Defines the arrangement of the UI elements. Common values include 'bottom-up' or 'top-down'.
--prompt <string>
Sets a custom string to be displayed as the prompt in the input field.
--selection-mode <mode>
Controls whether single ('single') or multiple ('multiple') items can be selected from the list.
--case-sensitive
Enables case-sensitive matching for the filter query. By default, matching is often case-insensitive.
--regexp
Interprets the filter query as a regular expression for matching patterns.
--exact
Performs exact string matching, disabling fuzzy matching.
DESCRIPTION
Peco (Perl Echo) is a minimalist yet powerful interactive filtering utility for Unix pipelines. It reads input from standard input (stdin), presents it to the user in an interactive curses-based interface, and allows the user to incrementally filter the results using fuzzy matching or exact string matching. As the user types, peco continuously refines the list, making it easy to quickly find and select specific items from a large set of data, such as command history, file paths, process IDs, or log entries.
Once the desired item(s) are selected (usually by pressing Enter), peco outputs the selected line(s) to standard output (stdout). This makes it highly versatile for integrating with other command-line tools. For instance, you can pipe the output of ls or history into peco to interactively select a file or a previous command, respectively. It supports various matching modes, keybindings for navigation, and can be customized via configuration files, making it a flexible tool for enhancing command-line productivity. It's often used as an alternative to fzf or percol for interactive filtering.
CAVEATS
Performance might be less optimal with extremely large inputs (e.g., millions of lines) compared to highly optimized native alternatives. The default keybindings might require a slight learning curve or customization if accustomed to other similar tools. Peco is primarily designed for line-by-line filtering and is less suited for complex structured data manipulation.
KEYBINDINGS AND CUSTOMIZATION
Peco's behavior, including its keybindings, display, and actions, is highly customizable. This is typically done via a JSON configuration file (e.g., `~/.peco/config.json`). Users can define custom actions for specific key presses, modify colors, adjust layout preferences, and fine-tune matching algorithms, making it highly adaptable to individual workflows and preferences.
INTEGRATION WITH SHELLS
Peco is frequently integrated into shell functions or aliases to enhance common command-line tasks. For example, it can be used to provide an interactive history search (often bound to Ctrl+R in shells), to interactively select files from a directory, or to filter process lists before acting on them. Its stdin/stdout piping nature makes it a perfect fit for various shell scripting scenarios.
HISTORY
Peco was created by Syohei YOSHIDA (lestrrat) in 2013 and is written in Go. Its name is a playful moniker, possibly derived from 'Perl Echo' or simply related to 'picking' items. It emerged as a user-friendly, interactive alternative to traditional command-line filtering methods, aiming to provide a more intuitive way to navigate and select from large lists of text. Its development was influenced by the need for a simple, yet powerful, interactive filter that could be easily integrated into shell workflows, particularly for navigating command history. It quickly gained popularity for its ease of use and flexibility in enhancing command-line productivity.
SEE ALSO
fzf(1): A general-purpose command-line fuzzy finder, widely used and known for its speed and features., percol(1): Another interactive grep-like tool, often considered a predecessor or alternative to peco and fzf., grep(1): A fundamental command-line utility for searching plain-text data for lines matching a regular expression., awk(1): A powerful text processing language, often used for data extraction, manipulation, and reporting from text files or streams.