How to stop re-Googling command-line flags
You know the command. You just can't remember whether it's -C or
-c, and whether the archive name comes before or after the file list. Here are five
ways to recall the right flags for any CLI — all of them offline, none of them a browser tab.
Everyone who lives in a terminal hits the same wall: tar has dozens of flags,
rsync has over a hundred, ffmpeg is effectively bottomless, and the ones
you need change from job to job. Reaching for a search engine works, but it pulls you out of the
shell and often serves answers for a different version of the tool than the one you have installed.
The techniques below keep you in the terminal and read the truth from the binary itself.
1. Start with --help (but filter it)
Almost every modern CLI prints a flag reference with --help (or -h).
The problem is volume: rsync --help is a wall of text. The trick is to pipe it into a
pager or a filter so you can search instead of scroll:
rsync --help | less # scroll + press / to search grep --help | grep -i recursive # jump straight to the flag you mean
This is the single highest-value habit: the tool's own --help is always correct
for your installed version, unlike any cheatsheet copied off the web.
2. Use man for the tools that hide their real docs
Classic Unix tools (find, tar, ssh, sort)
often ship a thin --help but a rich manual page. Jump straight to the options section:
man tar # then press / and type the option, e.g. /--strip-components man find | col -bx # dump it plain so you can grep it
apropos keyword (a.k.a. man -k) searches
all man page descriptions — handy when you remember what you want to do but not which
command does it: apropos compress.3. Keep a curated cheatsheet for the 20% you use daily
Community cheatsheet tools give you copy-pasteable examples for common tasks:
- tldr — short, example-first pages for popular commands.
- cheat.sh —
curl cheat.sh/tarfor a quick example set. - navi — an interactive cheatsheet you can build on.
These are excellent for the handful of tasks you repeat, but they share one limit: someone has
to have written the snippet. They won't help with a flag nobody documented, a brand-new release,
or your company's internal deploy tool.
4. Let your shell complete flags for you
Completion frameworks (bash-completion, zsh's compsys, fish's built-in completions)
can tab-complete flags for many commands. If you've never enabled them, it's worth ten minutes:
# zsh: once, in ~/.zshrc autoload -Uz compinit && compinit
The catch is coverage — completions exist for well-known tools, are sometimes stale, and rarely explain what a flag does; they just list names.
5. Pick flags interactively, from the tool's own help
The gap in everything above: --help is always correct but hard to read, while
cheatsheets are readable but incomplete and can drift from your version. What you actually want is
to read the real --help, but as a searchable, tickable list.
That's the itch behind cmdpeek, a small open-source CLI. Point
it at any command; it runs that command's own --help (falling back to its man page),
parses the flags and subcommands, and drops you into a fuzzy-searchable picker. You toggle the flags
you want, fill in their values, and it assembles a runnable command:
npx cmdpeek tar # interactive flag picker, parsed live from tar's help npx cmdpeek git commit # drills into subcommands too
Because it reads the installed binary, the flags it shows are the flags you actually have —
including private and internal tools no cheatsheet database will ever cover. It has zero runtime
dependencies, so npx cmdpeek <anything> just works.
Build a command with one keystroke
Add the shell widget to your rc file and you get an fzf-style hotkey: type a command name, press
Ctrl-G, pick flags, and the assembled command lands back on your prompt.
# bash: add to ~/.bashrc eval "$(cmdpeek --shell bash)" # then: type "rsync", hit Ctrl-G
Or just explain a command you were handed
The inverse problem — someone pastes you tar xzvf archive.tgz and you're not sure
what each part means — has an offline answer too:
npx cmdpeek explain tar xzvf archive.tgz
It annotates every token from the tool's own help, on every CLI on your PATH. Think of it as a local, offline explainshell that isn't limited to a curated man database.
Which technique when?
| Situation | Reach for |
|---|---|
| Quick example for a common task | tldr / cheat.sh |
| Exhaustive reference for your exact version | --help / man |
| "What does this command do?" | cmdpeek explain / explainshell |
| Assemble a command from many flags, interactively | cmdpeek (Ctrl-G widget) |
| A private/internal tool with no docs online | --help or cmdpeek |
The throughline: the most reliable source of truth for a command's flags is the command itself. Whatever tool you use, prefer the ones that read that source instead of a copy of it.