C.W.K.
Stream
Lesson 08 of 10 · published

Getting Help: --help, tldr, cheat.sh

~15 min · help, tldr, cheat, documentation

Level 0Window Tourist
0 XP0/95 lessons0/14 achievements
0/100 XP to next level100 XP to go0% complete

Three layers of "how do I use this?"

Man pages are exhaustive. Sometimes you don't want exhaustive. You want an example. tldr and cheat.sh exist to give you exactly that — copy-paste-ready snippets for the most common usages.

The --help flag — fastest answer

Almost every modern command supports --help (some only -h; a few stubborn ones use -?). The output is shorter than the man page and usually shows a one-line summary, the synopsis, and the most-used options. Pipe it through less if it's long: git --help | less.

tldr — community examples

tldr shows 5–8 example invocations for a command. tldr tar shows you how to extract, compress, list contents, preserve permissions — all real one-liners, not abstract option descriptions. Install with brew install tlrc or npm install -g tldr.

cheat.sh — searchable cheat sheets

Even more powerful: a curl-friendly knowledge base. curl cheat.sh/find spits a find cheat sheet. curl cheat.sh/python/list+comprehension answers programming questions. No install needed, but you can shell-alias cheat for convenience.

info — GNU's verbose alternative

GNU's preferred docs format. info bash opens a hyperlinked browser inside the terminal. Most developers ignore it because man and --help cover the daily need, but for things like grep and sed the GNU info pages have richer examples.

The order I actually use

  1. tldr — "give me a working example"
  2. command --help | less — "what flags exist?"
  3. man command — "I need the authoritative truth"
  4. cheat.sh — "weird question, hope someone wrote it down"

Code

Set up tldr and try it·bash
brew install tlrc          # Rust client, fast
tldr tar
tldr ssh
tldr --update              # refresh local pages
cheat.sh — no install·bash
curl cheat.sh/find
curl cheat.sh/rsync
curl 'cheat.sh/python/sort+dict+by+value'
# Make it your own command
echo 'cheat() { curl -s "cheat.sh/$1"; }' >> ~/.zshrc

External links

Exercise

Install tldr (brew install tlrc). Run tldr ssh, tldr rsync, tldr docker. Pick the command you use the most and read its tldr — note at least one flag you didn't know. Then curl cheat.sh/find and skim the patterns.

Progress

Progress is local-only — sign in to sync across devices.
Spotted a bug or have feedback on this page?Report an Issue

Comments 0

🔔 Reply notifications (sign in)
Sign inPlease sign in to comment.

No comments yet — be the first.