# cheat.sh

> Cheat sheet service queried with curl or the cht.sh client, covering 1000+ UNIX/Linux commands, 56 programming languages and several DBMSes.

Stars: 41.8k · Language: Python · License: MIT · Categories: Productivity

- Repository: https://github.com/chubin/cheat.sh
- Website: https://cheat.sh/
- Page: https://www.trmn.sh/tools/chubin-cheat

## Install

- Binary download (user): `PATH_DIR="$HOME/bin"  # or another directory on your $PATH`
- Binary download (user): `mkdir -p "$PATH_DIR"`
- Binary download (user): `curl https://cht.sh/:cht.sh > "$PATH_DIR/cht.sh"`
- Binary download (user): `chmod +x "$PATH_DIR/cht.sh"`
- Binary download (global): `curl -s https://cht.sh/:cht.sh | sudo tee /usr/local/bin/cht.sh && sudo chmod +x /usr/local/bin/cht.sh`

## Overview

cheat.sh is a cheat sheet service that aggregates community-driven cheat sheet repositories and serves them over HTTP. It covers more than 1000 UNIX/Linux commands, 56 programming languages and several DBMSes. You query it with curl or any HTTP client, for example `curl cheat.sh/tar` or `curl cht.sh/python/lambda`. Unknown command names can be found with keyword search, such as `curl cht.sh/~snapshot`. The README says answers usually return within 100 ms.

Programming language questions use per-language namespaces, for example `cht.sh/go/Pointers` or `cht.sh/python/random+string`. `:list` lists the available sheets, and `:learn` returns a language overview taken from the "Learn X in Y" project. If no sheet exists for a query, the service generates one from existing cheat sheets and StackOverflow answers. Output is formatted as code in the queried language, so it can be pasted into a program. Appending `/1`, `/2` and so on returns alternative answers. The option `?Q` strips comments, `?T` disables syntax highlighting, and `+-word` excludes sheets containing a word.

The optional `cht.sh` client lets you write queries with spaces instead of `+`. It has a shell mode (`cht.sh --shell`, which requires rlwrap) with a persistent language context (`cd go`), query history and readline support. It can copy the last answer to the clipboard, with or without comments, and it offers tab completion for bash, fish and zsh. A config file at `~/.cht.sh/cht.sh.conf` sets default query options such as the highlighting style. A stealth mode runs queries automatically for selected text. The README also lists self-hosting with Docker and integrations for Vim, Emacs, VS Code, Sublime, IntelliJ IDEA and QT Creator.

It suits developers and sysadmins who want quick command syntax or language snippets without leaving the terminal or editor.

### Installation

```bash
# via Binary download (user)
PATH_DIR="$HOME/bin"  # or another directory on your $PATH
mkdir -p "$PATH_DIR"
curl https://cht.sh/:cht.sh > "$PATH_DIR/cht.sh"
chmod +x "$PATH_DIR/cht.sh"
```

```bash
# via Binary download (global)
curl -s https://cht.sh/:cht.sh | sudo tee /usr/local/bin/cht.sh && sudo chmod +x /usr/local/bin/cht.sh
```

![cheat.sh queried with curl](https://media.trmn.sh/cached/1574e4a585b4be5571b8e02de9b3b04c9ac269b61841ad98ef58884cb3d196e7.gif)

![cht.sh URL structure](https://media.trmn.sh/cached/eb3fd8163a7a111b140eb9ff3f0c8cf0f190046a352a5d917da2ca9312cf8d70.png)

## Alternatives

- [jrnl](https://www.trmn.sh/tools/jrnl.md): Command-line journal application that creates, searches, and views entries stored as plain text, with optional AES encryption. (Python, 7.4k stars)
- [buku](https://www.trmn.sh/tools/buku.md): Command-line bookmark manager with search, browser import, encryption, and local web UI (Python, 7.2k stars)
- [scli](https://www.trmn.sh/tools/scli.md): Terminal user interface for Signal messaging with Vim-like navigation and external editor support (Python, 537 stars)
- [tempy](https://www.trmn.sh/tools/tempy.md): Terminal weather report tool displaying current and near-future conditions without requiring API keys (Python, 194 stars)
- [gws](https://www.trmn.sh/tools/gws.md): Command-line tool for Google Workspace APIs (Drive, Gmail, Calendar, Sheets, Chat) with commands built at runtime from Google's Discovery Service. JSON output. (Rust, 32.0k stars)

---

Canonical: https://www.trmn.sh/tools/chubin-cheat
