~/shio.sh/learn/man-pages $ ./read
chapter 09 · learn the terminal
Manual pages (man, --help)
man shows the manual for any command. --help is the short version. When you're stuck, ask the program itself.
$ man — the manual
Every classic Unix command ships with a manual page. Type man followed by the command name and you get a small reference book on it: what it does, every flag, examples, related commands.
man lsIn a real terminal, man opens in a pager (space scrolls, q quits, /word searches). Here in the sandbox, it prints a one-line summary — enough to remember what each command does.
› try: man ls
$ --help — the short version
Most modern command-line programs respond to --help with a short usage summary. It's faster than reading a manual page when you just need a reminder.
grep --help$ reading a synopsis
Manual pages start with a SYNOPSIS line that looks like a small grammar:
ls [-aAhl] [file ...]The conventions:
- Things in
[brackets]are optional. ...means "one or more."- Flags written together like
-aAhlcan be combined or split.
Once you can read a SYNOPSIS, you can teach yourself any command without looking it up online.
$ when you're stuck
The order I reach for, in real life:
command --help— fastest, often enough.man command— when you need the full picture.- Search the web — only after the first two come up short.
The programs themselves are the most authoritative source. Asking ls what it does is more reliable than asking the internet what ls does.
~/shio.sh/learn/man-pages $ cd ..