Files
cheat/doc/cheat.1.md
Christopher Allen Lane 80e0e0d3ae feat: add --update/-u flag to pull git-backed cheatpaths (#552)
Iterates over configured cheatpaths and runs git pull on each one that
is a git repository with a clean worktree. Supports SSH remotes via key
file discovery and SSH agent fallback. Works with --path filtering.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-15 19:51:40 -05:00

4.7 KiB

% CHEAT(1) | General Commands Manual

NAME

cheat — create and view command-line cheatsheets

SYNOPSIS

| cheat [options] [CHEATSHEET]

DESCRIPTION

cheat allows you to create and view interactive cheatsheets on the command-line. It was designed to help remind *nix system administrators of options for commands that they use frequently, but not frequently enough to remember.

OPTIONS

--init
Print a config file to stdout.
--conf
Display the config file path.
-a, --all
Search among all cheatpaths.
-b, --brief
List cheatsheets without file paths.
-c, --colorize
Colorize output.
-d, --directories
List cheatsheet directories.
-e, --edit=CHEATSHEET
Open CHEATSHEET for editing.
-l, --list
List available cheatsheets.
-p, --path=PATH
Filter only to sheets found on path PATH.
-r, --regex
Treat search PHRASE as a regular expression.
-s, --search=PHRASE
Search cheatsheets for PHRASE.
-t, --tag=TAG
Filter only to sheets tagged with TAG.
-T, --tags
List all tags in use.
-u, --update
Update git-backed cheatpaths by pulling the latest changes.
-v, --version
Print the version number.
--rm=CHEATSHEET
Remove (deletes) CHEATSHEET.
--completion=SHELL
Generate a shell completion script. SHELL must be one of: bash, zsh, fish, powershell.

EXAMPLES

To view the foo cheatsheet:
cheat foo
To edit (or create) the foo cheatsheet:
cheat -e foo
To edit (or create) the foo/bar cheatsheet on the 'work' cheatpath:
cheat -p work -e foo/bar
To view all cheatsheet directories:
cheat -d
To list all available cheatsheets:
cheat -l
To briefly list all cheatsheets whose titles match 'apt':
cheat -b apt
To list all tags in use:
cheat -T
To list available cheatsheets that are tagged as 'personal':
cheat -l -t personal
To search for 'ssh' among all cheatsheets, and colorize matches:
cheat -c -s ssh
To search (by regex) for cheatsheets that contain an IP address:
cheat -c -r -s '(?:[0-9]{1,3}.){3}[0-9]{1,3}'
To remove (delete) the foo/bar cheatsheet:
cheat --rm foo/bar
To update all git-backed cheatpaths:
cheat --update
To update only the 'community' cheatpath:
cheat -u -p community
To view the configuration file path:
cheat --conf

FILES

Configuration

cheat is configured via a YAML file that is conventionally named conf.yml. cheat will search for conf.yml in varying locations, depending upon your platform:

Linux, OSX, and other Unixes

  1. CHEAT_CONFIG_PATH
  2. XDG_CONFIG_HOME/cheat/conf.yml
  3. $HOME/.config/cheat/conf.yml
  4. $HOME/.cheat/conf.yml
  5. /etc/cheat/conf.yml

Windows

  1. CHEAT_CONFIG_PATH
  2. APPDATA/cheat/conf.yml
  3. PROGRAMDATA/cheat/conf.yml

cheat will search in the order specified above. The first conf.yml encountered will be respected.

If cheat cannot locate a config file, it will ask if you'd like to generate one automatically. Alternatively, you may also generate a config file manually by running cheat --init and saving its output to the appropriate location for your platform.

Cheatpaths

cheat reads its cheatsheets from "cheatpaths", which are the directories in which cheatsheets are stored. Cheatpaths may be configured in conf.yml, and viewed via cheat -d.

For detailed instructions on how to configure cheatpaths, please refer to the comments in conf.yml.

Autocompletion

cheat can generate shell completion scripts for bash, zsh, fish, and powershell via the --completion flag:

cheat --completion bash
cheat --completion zsh
cheat --completion fish
cheat --completion powershell

Completions are dynamically generated and include cheatsheet names, tags, and cheatpath names.

To install completions, pipe the output to the appropriate location for your shell. For example, on bash:

cheat --completion bash > /etc/bash_completion.d/cheat

Or for the current user only:

cheat --completion bash > ~/.local/share/bash-completion/completions/cheat

For zsh, you may need to add the completions directory to your fpath:

cheat --completion zsh > "${fpath[1]}/_cheat"

For fish:

cheat --completion fish > ~/.config/fish/completions/cheat.fish

ENVIRONMENT

CHEAT_CONFIG_PATH

The path at which the config file is available. If CHEAT_CONFIG_PATH is set, all other config paths will be ignored.

RETURN VALUES

  1. Successful termination

  2. Application error

  3. Cheatsheet(s) not found

BUGS

See GitHub issues: https://github.com/cheat/cheat/issues

AUTHOR

Christopher Allen Lane chris@chris-allen-lane.com

SEE ALSO

fzf(1)