cheat
Display command usage examples and explanations
TLDR
Show example usage of a command
Edit the cheat sheet for a command
List the available cheat sheets
Search available the cheat sheets for a specified command name
Display version
SYNOPSIS
cheat [options] <sheet-name>
PARAMETERS
sheet-name
The name of the cheat sheet to display, edit, create, or delete.
-l, --list
Lists all available cheat sheets in the configured directories.
-s <keyword>, --search <keyword>
Searches for cheat sheets containing the specified keyword in their content or name.
-e <sheet-name>, --edit <sheet-name>
Opens the specified cheat sheet in your default text editor ($EDITOR). If the sheet does not exist, it will be created.
-c <sheet-name>, --create <sheet-name>
Creates a new, empty cheat sheet with the given name. Equivalent to -e if the sheet doesn't exist.
-d <sheet-name>, --delete <sheet-name>
Deletes the specified cheat sheet from your collection.
-p, --paths
Displays the paths where cheat looks for cheat sheets.
-T <template-name>, --template <template-name>
When creating a new cheat sheet, use an existing cheat sheet as a template.
-f, --force
Forces an action, such as overwriting an existing cheat sheet when creating with a template.
-v, --version
Displays the current version of the cheat command.
-h, --help
Displays the help message and exits.
DESCRIPTION
The cheat command is a versatile command-line utility designed to help users create, view, and manage their own custom cheat sheets directly from the terminal. It's an invaluable tool for programmers, system administrators, and anyone who frequently uses the command line and needs quick access to syntax, commands, or procedural notes.
Users can easily define cheat sheets for various commands, programming languages, or specific tasks. When invoked, cheat displays the content of a requested cheat sheet, allowing for rapid recall of information without needing to consult lengthy man pages or external documentation. Its integration with the user's preferred text editor (via the $EDITOR environment variable) makes creating and modifying these personal knowledge bases intuitive and efficient. It supports searching, listing available sheets, and managing them through simple commands.
CAVEATS
The cheat command relies on your $EDITOR environment variable being set for editing functionality. If it's not set, editing will not work. Additionally, cheat sheets are stored as plain text files, meaning sensitive information should not be stored unencrypted within them. Users are responsible for managing their cheat sheet directories and permissions.
CONFIGURATION
cheat's behavior can be customized by setting the $CHEATPATHS environment variable, which defines the directories where cheat looks for cheat sheets. By default, it checks ~/.cheat and system-wide paths. Users can also configure a preferred editor by setting the $EDITOR environment variable (e.g., export EDITOR=nvim).
CREATING CUSTOM SHEETS
To create a new cheat sheet, simply run cheat -e <sheet-name>. This will open your editor, where you can type your notes. The content is saved as plain text. It's recommended to organize sheets by command name (e.g., 'git', 'awk', 'tar') or topic (e.g., 'networking', 'docker').
HISTORY
The cheat command-line utility was created by Chris Allen as a Python-based open-source project. Its development began with the goal of providing a simple, customizable, and fast way for developers and sysadmins to store and retrieve personal command-line notes. Over time, it has gained popularity as a lightweight alternative to more complex documentation systems, focusing on user-generated content and easy accessibility directly from the terminal.