Table of Contents
To see examples for a Linux command, pass its name to cheat.sh with curl. For example, curl -fsS https://cht.sh/tar prints common tar recipes in your terminal. You need an internet connection and either curl or a browser.
Look up a command by name
curl -fsS https://cht.sh/tar
curl -fsS https://cht.sh/find
The sheet is a quick reference. Compare an example with man tar or the help for your installed command before running it, especially if it deletes, overwrites, or moves data. If you’re new to the tools, see the guides to using curl and finding files in Linux.
Look up a programming example
For programming topics, use a language name followed by the topic. In this example, the plus sign separates the words in the query. The Git example looks up the merge subcommand.
curl -fsS 'https://cht.sh/python/list+comprehension'
curl -fsS 'https://cht.sh/git/merge'
The service receives the terms you put in the URL. Keep private filenames, access tokens, and work data out of queries. Read downloaded examples before copying them into your shell.
Add a Bash or Zsh shortcut
If you look up examples often, add the function below to ~/.bashrc for interactive Bash or ~/.zshrc for Zsh. Open a new terminal and run cht tar. The function also accepts a programming topic such as cht python/list+comprehension.
cht() {
curl -fsS "https://cht.sh/$1"
}
Use the separate cheat program for local notes
The cheat command-line program is a separate tool for storing and editing local sheets. Install and configure it using the project’s instructions. Once your sheets are on disk, you can consult them offline.
cheat -l
cheat tar
cheat -e my-command
The first command lists your available sheets, the second opens the tar sheet, and the third opens an editable sheet in your configured editor. For a quick online example, use cheat.sh. For personal notes or offline reference, keep local sheets or use the manual pages installed on your machine.
Reader Comments 0
Sign in with email or Google to join the discussion.