Skip to content

Guide · Open source

How to use cheat: view, create and search command-line cheatsheets

Updated · written with AI from the project's own documentation and checked against our catalogue data

cheat is an open-source command-line tool that shows short cheatsheets of example commands, such as the common options for tar, and lets you write your own. It was designed for Unix-like system administrators who use some commands too rarely to remember their syntax. After this guide you will know how to view, edit, organize and search cheatsheets from your terminal.

cheatcheat/cheat · ★ 13.5k · MIT

Quick start

  1. 1Follow the install guide. Open INSTALLING.md in the cheat repository and complete the install steps for your system.
  2. 2Try a community sheet. Run cheat tar. On first run you will be asked whether to install the community-sourced cheatsheets.
  3. 3Create your own sheet. Run cheat -e followed by a command name to create and edit a plain-text sheet.
  4. 4Organize with cheatpaths. Define a personal cheatpath in conf.yml and set readonly as needed for shared directories.
  5. 5Search your sheets. Use cheat -s with a phrase, or add -r for a regular expression.
  6. 6Enable completion. Generate a completion script for your shell and save it where that shell loads completions.

What cheat does and who it is for

cheat allows you to create and view interactive cheatsheets on the command line. You type a command name and it shows you examples you can copy. The project was built to remind *nix system administrators of options for commands they use often but not often enough to remember.

It is a good fit if you work on Unix-like systems, forget command syntax between uses, or want personal command notes in plain text. It is not a graphical or web app, and it is not a beginner tutorial: it shows reference snippets rather than explanations.

Install cheat

The README does not list install commands in full. It points to INSTALLING.md in the repository for installation and configuration instructions. Read that file first, since it covers the steps for your system.

cheat is written in Go, so the project's install guide is the place to check how to get a working binary onto your machine.

View a cheatsheet with cheat tar

Run the command name after cheat to see its cheatsheet. The README's example shows a sheet for tar with entries such as extracting an uncompressed archive and creating a .gz archive. Each entry is a comment followed by a command you can copy.

Nested sheets use a path. A top-level sheet is viewed by name, and a nested one by folder and name.

  • cheat tar opens the top-level tar sheet.
  • cheat foo/bar opens the nested sheet named bar in a foo subdirectory.
cheat tar # a "top-level" cheatsheet cheat foo/bar # a "nested" cheatsheet

Create and edit your own cheatsheets

Use the -e flag to edit a sheet. If the sheet does not exist, cheat creates it. Cheatsheets are plain-text files with no file extension, named after the command used to view them.

You can add an optional YAML frontmatter header to set tags and the syntax used for highlighting. Syntax highlighting is provided by Chroma, and the syntax value can be any lexer name Chroma supports.

  • Plain-text files with no file extension.
  • Optional frontmatter with tags and syntax.
  • Highlighting covers any Chroma lexer name.
cheat -e tar # opens the "tar" cheatsheet for editing, or creates it if it does not exist cheat -e foo/bar # nested cheatsheets are accessed like this

List, filter and search sheets

Several flags help you find sheets. -l lists all available cheatsheets, and -b gives a brief list with names and tags only. You can combine -l with -t to filter by tag, or with -p to limit results to one cheatpath. -d shows your configured cheatpaths.

To search the text of your sheets, use -s. Add -r to treat the search as a regular expression. The README notes that flags can be combined.

  • -d shows configured cheatpaths.
  • -l lists all sheets; -b lists names and tags only.
  • -l -t networking lists sheets tagged networking.
  • -s ssh searches for the phrase ssh.
cheat -d cheat -l cheat -b cheat -l -t networking cheat -l -p personal cheat -s ssh cheat -r -s '(?:[0-9]{1,3}\.){3}[0-9]{1,3}' cheat -p personal -t networking --regex -s '(?:[0-9]{1,3}\.){3}[0-9]{1,3}'

Set up cheatpaths for personal and shared sheets

Cheatsheets live on cheatpaths, which are directories set in the conf.yml file. A common pattern is one cheatpath per repository. Setting readonly to true stops cheat from editing or creating sheets on that path, which helps avoid merge conflicts on upstream repositories. If you edit a sheet on a read-only path, cheat copies it to a writeable directory first.

A directory-scoped .cheat directory is also found by searching the current directory and its ancestors, similar to how git finds .git. Its nearest copy is temporarily added to the cheatpaths.

  • name, path, tags and readonly are set per cheatpath.
  • Put a .cheat directory at a project root to make its sheets available in subdirectories.
cheatpaths: - name: community path: ~/documents/cheat/community tags: [ community ] readonly: true - name: personal path: ~/documents/cheat/personal tags: [ personal ] readonly: false

Turn on shell completion

cheat can generate completion scripts for bash, zsh, fish and powershell with the --completion flag. Redirect the output to the location your shell reads. Completions include cheatsheet names, tags and cheatpath names.

The README gives these examples. Choose the line for your shell, and check your shell's documentation if your completion directory differs.

  • bash: user-local or system-wide location.
  • zsh: a directory on your fpath.
  • fish: ~/.config/fish/completions.
cheat --completion bash > ~/.local/share/bash-completion/completions/cheat cheat --completion zsh > "${fpath[1]}/_cheat" cheat --completion fish > ~/.config/fish/completions/cheat.fish

What people use it for

  • Recalling tar options for extracting or creating .gz and .bz2 archives.
  • Keeping personal command notes in plain-text files you can version in Git.
  • Sharing a read-only community cheatpath alongside a personal, writeable one.
  • Attaching project-specific sheets to a repository with a .cheat directory.
  • Searching all sheets for a phrase or an IP address pattern using a regex.

Frequently asked questions

How do I install cheat?

The README does not give the install commands itself. It refers to INSTALLING.md in the repository, which contains the installation and configuration instructions.

Is cheat free to use and what is its licence?

cheat is released under the MIT licence, according to the project information. The MIT licence permits use, including in commercial settings, subject to its terms.

What do I need to run cheat?

The source does not list prerequisites. The project is written in Go, and INSTALLING.md is the place to check what your system needs.

Does cheat include cheatsheets?

The cheat executable includes no cheatsheets. On the first run it asks whether you want to install the community-sourced cheatsheets.

What are the alternatives to cheat?

Comparable projects named in the analysis are tldr, navi and cheat.sh. cheat is a command-line tool where you write and organize your own plain-text sheets.

Can cheat run in a graphical or web interface?

No. The README describes only a command-line tool, so it is not a graphical or web-based interface.

New agent skills, repos and AI tools — every week

The best new skills and open-source projects, the fastest-growing repos, and one free prompt. Five minutes to read. Unsubscribe anytime.

Our verdict

cheat suits sysadmins and developers who work in a Unix-like terminal and want to keep and search their own plain-text command notes. If you want a graphical or web interface, or step-by-step explanations for learning a command, pick a different tool.

Install options & downloads