← 返回命令列表

Linux command

percol 命令

文本

涉及管道、覆盖或删除,执行前请先确认路径和参数。

常用示例

Interactive filter over stdin

[command] | percol

Pick a line from shell history

history | percol

Search files interactively

find . | percol

Seed the query

percol --query [pattern] [file]

Show the prompt at the bottom

percol --prompt-bottom --result-bottom-up

Checkout a git branch interactively

git checkout $(git branch | percol)

Kill a process picked from ps

ps aux | percol | awk '{print $2}' | xargs kill

说明

percol is an interactive grep-and-select tool inspired by Emacs' `anything`/`helm`. It reads candidate lines from stdin or a file, shows them in a curses UI, and narrows the list as you type. Pressing Return prints the selected line(s) to stdout, making it a drop-in component for shell pipelines. Configuration (prompt, colors, keymap, match method) lives in `~/.percol.d/rc.py` as Python — percol itself is written in Python, so the rc file has full access to the percol API.

参数

--tty _TTY_
Terminal device file to use (default `/dev/tty`).
--rcfile _FILE_
Path to the percol init/config file (default `~/.percol.d/rc.py`).
--output-encoding _ENC_, --input-encoding _ENC_
Force character encoding of output/input.
--query _STRING_
Initial query string.
--eager
Show all candidates immediately (no incremental search).
--reverse
Reverse the order of input lines.
--auto-match
Automatically select when there is a single match.
--auto-fail
Exit non-zero if no lines match the query.
--match-method _METHOD_
Matching method: `string` (default), `regex`, or `migemo` (Japanese romaji).
--case-sensitive / --caseless-match-regex-if-lowercase
Control case sensitivity of the query.
--prompt _STRING_
Custom prompt format (supports Python-style formatting).
--prompt-top / --prompt-bottom
Show the prompt at the top (default) or bottom of the display.
--result-top-down / --result-bottom-up
Control result list ordering on screen.
--query-multiline
Allow the query input to span multiple lines.
-h, --help
Show help.

FAQ

What is the percol command used for?

percol is an interactive grep-and-select tool inspired by Emacs' `anything`/`helm`. It reads candidate lines from stdin or a file, shows them in a curses UI, and narrows the list as you type. Pressing Return prints the selected line(s) to stdout, making it a drop-in component for shell pipelines. Configuration (prompt, colors, keymap, match method) lives in `~/.percol.d/rc.py` as Python — percol itself is written in Python, so the rc file has full access to the percol API.

How do I run a basic percol example?

Run `[command] | percol` in a terminal, then adjust file names, paths, flags, or remote targets for your system.

What does --tty _TTY_ do in percol?

Terminal device file to use (default `/dev/tty`).