$_ CLI In Depth
Learning progress 0%
lesson terminal shell kernel

Reading man Pages, --help & info

6 min read Module 1: Terminal, Shell & Kernel Updated Dec 5, 2026
Cheat Sheet
0:00 / 3:20

Where documentation lives

A command you type can be one of three kinds of thing: a shell builtin that bash runs itself, a shell keyword such as if, or an external program stored as a file somewhere on $PATH. Each kind has a different home for its documentation. Builtins and keywords are documented by bash, and you read them with the help builtin. External programs are usually documented in man pages, and many GNU programs also have longer info manuals. Nearly every program also prints a usage summary when you pass --help.

Before you look anything up, find out which kind of thing you have. The type builtin does this:

BASH3 lines
type printf
type time
type -a echo

The output in the lab is printf is a shell builtin, then time is a shell keyword, and for type -a echo, two lines: echo is a shell builtin followed by echo is /bin/echo. The last case matters. Bash runs its own echo at the prompt, but the external program /bin/echo also exists and is the one you get if you run it by its full path or from a script started by another shell. Knowing this tells you that help echo describes the builtin, and man 1 echo describes the program.

Man page sections

A man page belongs to one of several numbered sections. The same name can exist in more than one section, and the number tells you which kind of thing it documents. The standard sections on Linux are:

SectionCoversExample
1User commands (executable programs and shell utilities)man 1 ls
2System calls, the kernel interfaceman 2 openat
3Library functions, mostly the C libraryman 3 printf
4Special files, such as device filesman 4 tty
5File formats and configuration filesman 5 passwd
7Overviews, conventions, and miscellanyman 7 pty
8System administration commandsman 8 mount

The classic example is printf. Section 1 documents the printf command you run in a shell, and section 3 documents the C library function printf(3) that programs call. Both pages are correct for their own purpose. When you write man printf with no section, man shows the first match in its search order, which is usually section 1. Write the section number explicitly when you mean the other one. The same convention appears in documentation as printf(3), which means "the page printf in section 3".

Reading the SYNOPSIS

Every man page has a SYNOPSIS section that gives the syntax in a compact notation. Learning the notation is more useful than memorizing the options. The common symbols are:

  • [ ] marks something optional, such as [OPTION].
  • ... after an item means it can be repeated, as in [FILE]....
  • | separates alternatives. You pick one side.
  • Bold text or capitalized words such as FILE stand for a value you supply, and - or -- prefixes are literal.

So ls [OPTION]... [FILE]... means that you can give zero or more options and then zero or more file names. In the lab, you can get the same information from the program itself with --help, which is covered below.

Navigating a man page

On a normal system, man opens the page in less, a pager. The keys are the ones to learn:

  • Space and b move a page forward and back.
  • / followed by a pattern searches forward, and n jumps to the next match.
  • g and G go to the top and bottom.
  • q quits and returns you to the prompt.

To find a page when you only know a topic, use man -k or its equivalent apropos. Both search the one-line NAME descriptions of every page:

BASH2 lines
man -k copy
apropos copy

The results are lines such as cp (1) - copy files and directories, which tell you the name and section to open next. whatis ls prints only the one-line description of a single page.

info manuals and --help

Many GNU projects maintain longer manuals in the info format, which has its own reader. Its navigation keys are different: n and p move to the next and previous node, u goes up one level, and Enter follows a link. The coreutils manual, which covers ls, cp, and friends, is written as info and is also published online at gnu.org. Reading the online version is often faster than the terminal reader.

For a quick reminder of the options, --help is the fastest route. It prints a usage line and a list of options, and it does not open a pager:

BASH1 lines
ls --help | head -n 6

Be careful with -h. It is not a universal help flag. In du and ls it means human-readable sizes, and in other programs it means something else again. Use --help to get help.

Bash builtins: the help command

Man pages do not document builtins like cd. Bash documents them itself, through the help builtin. It prints the syntax and a description:

BASH3 lines
help cd
help -d cd
help -s cd

help cd prints the full description. help -d cd prints only the one-line summary. help -s cd prints only the synopsis line. These flags exist in bash 5, and they are the fastest way to check the syntax of a builtin. The reference for everything else bash does is the bash(1) man page, whose section named SHELL BUILTIN COMMANDS is the long form of the same material. The GNU Bash Reference Manual online is the same content in a readable form.

In this lab: no man or info

Note

The lab image does not include the man or info programs, and it does not include the man page files. They were removed to keep the image small. Typing man ls here fails with a "command not found" error. This is common on real systems too: minimal containers and embedded images often ship without documentation, so learning to work without it is a useful skill.

In the lab, use these instead: --help for external programs, help for builtins, type to identify what you are running, and the online pages at man7.org for the full text of a Linux man page. Once you have the page open, the section and notation rules above apply unchanged. On a real machine, the same commands work with man in front of them.

Exit status, && and ||

Visualizer

Every command ends with a number from 0 to 255. Zero means success; everything else is a kind of failure, and &&, || and if branch on it.

1 / 6
$ true; echo $?
0
status
0
meaning
success

true does nothing and exits 0. Zero is the only success value.

true; echo $?; false; echo $?; ls /nope; echo $?; nosuchcmd; echo $?
Terminal lab · 3 steps · real Linux in your browser

Find answers without a search engine

Use the help builtin, --help output, and man page sections to answer real questions.

01
Ask a builtin
cd is a builtin, so its documentation lives in bash: run help cd. Which option makes cd use the physical directory structure without following symbolic links? Write just the option (for example -X) into cd-option.txt.
Show hint for step 1
Look for the line that mentions "physical directory structure".
02
Ask a program
ls is a program, so it documents itself with --help. Find the long option that prints sizes like 1K 234M 2G, and write it (for example --some-option) into ls-option.txt.
Show hint for step 2
`ls --help | grep -i human`
03
Pick the manual section
On a full system, man open could show a command or the system call. Which manual section documents system calls such as openat and read? Write the section number into section.txt.
Show hint for step 3
Section 1 is commands, 3 is library functions.
Check yourself Question 1 of 4
Concept Check Section of library functions recall

Which man page section documents library functions such as printf(3), as opposed to the printf shell command in section 1?

Recap & Key Takeaways

Use type first to learn whether a name is a builtin, a keyword, or an external program, then choose the matching documentation source.
Man sections matter: section 1 is commands, 2 is system calls, 3 is library functions, 5 is file formats, 7 is overviews, and 8 is administration commands.
In a SYNOPSIS, square brackets are optional, an ellipsis means repeatable, and a vertical bar separates alternatives.
The lab has no man or info; use --help, help (with -d or -s for short forms), and the man7.org pages instead.
Was this lesson helpful? Spot an issue or have a suggestion? Let us know on GitHub.
Report an issue