| |

LFCS 8 ๐Ÿง Getting Help โ€” man, –help, info

The LFCS allows access to documentation. Every system has it, and every task on the exam can be completed with it. The man command is the primary interface to the documentation on a Linux system. The --help flag is the quick summary. The info command is the alternative hypertext format. Knowing how to find the answer is more valuable than memorizing the answer, because the exam rewards the ability to look things up under time pressure.

Key point: man displays a command’s manual page, which contains the full documentation: name, synopsis, description, options, files, and see-also. The --help flag prints a short usage summary. info displays the GNU documentation in a navigable hypertext format. The man command has sections, and a command may have pages in more than one section. The apropos and whatis commands search the manual page database.


Why getting help matters

The exam problem. The LFCS is performance-based and allows documentation. The exam environment has man pages installed. A candidate who knows how to find the right option for lvcreate is not disadvantaged by not having memorized it. A candidate who does not know how to search the documentation is.

The memorization problem. Linux has thousands of commands, each with dozens of options. No one memorizes all of them. The skill is knowing which command to use and how to find its options. The man page is the answer, and knowing how to read one is a core competency.

The distribution problem. The exam is distribution-independent, but the commands differ. A man page on Ubuntu and a man page on CentOS document the same command differently in some cases. Reading the page on the system you are using is the reliable approach.

The update problem. Commands change. Options are added and deprecated. The man page on the system reflects the version of the command that is installed. The online documentation may be for a different version. The local man page is the authoritative source for the installed software.

The scripting problem. A script that uses a command’s option needs to know the option exists in the installed version. The man page confirms it. The --help flag is even faster for checking a specific option.


a. The man command

The man command displays a manual page. The argument is the name of a command, a file, a system call, or a library function.

$ man ls

The page opens in a pager, usually less. The navigation keys are the same as less: space for the next page, b for the previous page, / for search, n for the next search match, and q to quit.

The structure of a manual page is consistent.

SectionContent
NAMECommand name and one-line description
SYNOPSISUsage syntax
DESCRIPTIONDetailed description
OPTIONSOption flags
FILESFiles the command uses
EXAMPLESUsage examples (if present)
SEE ALSORelated commands

The SYNOPSIS uses conventions that are worth knowing.

ConventionMeaning
boldType as written
italicReplace with a value
[-abc]Optional flags
-a|-bEither -a or -b
...Repeatable
SYNOPSIS
       ls [OPTION]... [FILE]...

The ls command takes options and files, both optional and repeatable. The brackets indicate optional. The ... indicates that the argument can be repeated.

The man command has options of its own.

OptionEffect
-kSearch by keyword (same as apropos)
-fShort description (same as whatis)
-aShow all matching pages
-wShow the path to the page
-KSearch all pages for a string
$ man -k "copy file"
$ man -f ls
$ man -a passwd
$ man -w ls
$ man -K "recursive copy"

The man -k searches the manual page descriptions for a keyword. It is the same as apropos. The man -f prints the short description. It is the same as whatis. The man -a shows all pages with the same name in different sections. The man -w shows the path to the page file. The man -K searches the full text of all pages.


b. Manual sections

The manual is divided into sections. A command can have a page in more than one section. The man command uses the first page it finds, but the section can be specified.

SectionContent
1User commands
2System calls
3Library functions
4Special files (devices)
5File formats and conventions
6Games
7Miscellaneous
8System administration commands
9Kernel routines
$ man 1 ls        # user command
$ man 5 passwd    # file format
$ man 8 mount     # system administration

The passwd command has two pages: one in section 1 for the user command and one in section 5 for the file format. man passwd shows the section 1 page. man 5 passwd shows the file format page. The same is true for mount, which has pages in sections 2, 5, and 8.

The section can be inferred from the content. A command that changes the system is in section 8. A file format is in section 5. A system call is in section 2. When the page you get is not the page you want, the section is the likely cause.

The man -a option shows all pages with the same name in sequence.

$ man -a passwd

The first page is displayed, and pressing q continues to the next page. This is useful when the section is not known.

The whatis command shows the short description of a command and the section it is in.

$ whatis passwd
passwd (1)           - change user password
passwd (5)           - the password file

The output lists the command, the section in parentheses, and the description. The section tells you which page to read.

The apropos command searches the descriptions for a keyword. It is the tool to use when the command name is not known.

$ apropos copy
cp (1)               - copy files and directories
cpio (1)             - copy files to and from archives
dd (1)               - convert and copy a file
rsync (1)            - a fast, versatile, remote (and local) file-copying tool
scp (1)              - secure copy (remote file copy program)

The output lists the commands, their sections, and their descriptions. The apropos search is case-insensitive by default.

The man -k and apropos commands are equivalent. They search the same database. The database is generated by mandb or makewhatis.


c. The –help flag and info

The --help flag prints a short usage summary. It is faster than a man page and is often the first thing to try.

$ ls --help
Usage: ls [OPTION]... [FILE]...
List information about the FILEs (the current directory by default).
Sort entries alphabetically if none of -cftuvSUX nor --sort is specified.

Mandatory arguments to long options are mandatory for short options too.
  -a, --all                  do not ignore entries starting with .
  -A, --almost-all           do not list implied . and ..
  -l                         use a long listing format
  -h, --human-readable       with -l, print sizes like 1K 234M 2G
  ...

The output is not standardized across commands. Some commands have a --help flag that prints a summary and exits 0. Others print to standard error and exit 1. Some have no --help flag at all. The man page is always available; the --help flag is not.

A command that does not have a --help flag may have a -h flag that does something else. The -h for ls is human-readable, not help. Always check the man page for the command’s actual flags.

The info command displays the GNU documentation. It is a hypertext format with nodes and links.

$ info ls

The info interface uses keystrokes that are different from less. The n key goes to the next node, p to the previous, u to the parent, and q to quit. The info pages are often more detailed than the man pages for GNU tools.

The info pages are stored in /usr/share/info/. The man pages are stored in /usr/share/man/. The man pages are more widely available; the info pages exist for GNU tools but not for everything.

The man command falls back to info if the man page is not found and an info page exists. The info command is the primary documentation for GNU tools like coreutils, bash, and grep.

The pinfo command is an alternative info viewer with color and mouse support. It is not installed by default on all systems.


Complete Example Session

# ============================================
# PART 1: BASIC MAN
# ============================================
$ man ls
# ============================================
# PART 2: MAN SECTIONS
# ============================================
$ man 5 passwd
$ man 8 mount
# ============================================
# PART 3: WHATIS
# ============================================
$ whatis passwd
passwd (1) - change user password
passwd (5) - the password file
# ============================================
# PART 4: APROPOS
# ============================================
$ apropos "copy file"
$ man -k "copy file"
# ============================================
# PART 5: MAN -F
# ============================================
$ man -f ls
ls (1) - list directory contents
# ============================================
# PART 6: MAN -A
# ============================================
$ man -a passwd
# ============================================
# PART 7: --HELP
# ============================================
$ ls --help
$ grep --help
$ tar --help
# ============================================
# PART 8: INFO
# ============================================
$ info ls
$ info coreutils
# ============================================
# PART 9: MAN -W
# ============================================
$ man -w ls
/usr/share/man/man1/ls.1.gz
# ============================================
# PART 10: MAN -K
# ============================================
$ man -K "recursive copy"

The ten parts covered basic man, sections, whatis, apropos, man -f, man -a, --help, info, man -w, and man -K.


Quick Reference

man Options

OptionEffect
man commandShow the page
man N commandShow the page in section N
man -k keywordSearch descriptions
man -f commandShort description
man -a commandAll matching pages
man -w commandPath to the page
man -K stringSearch all pages

Manual Sections

SectionContent
1User commands
2System calls
3Library functions
4Special files
5File formats
6Games
7Miscellaneous
8System administration
9Kernel routines

Search Commands

CommandPurpose
apropos keywordSearch descriptions
whatis commandShort description and section
man -k keywordSame as apropos
man -f commandSame as whatis

Other Help

CommandPurpose
command --helpShort usage summary
info commandGNU hypertext documentation
pinfo commandAlternative info viewer

man Navigation

KeyAction
SpaceNext page
bPrevious page
/patternSearch forward
nNext match
qQuit

Best Practices

โœ… Do This:

# Use man for the full documentation
man ls                                                         # โœ…

# Use the section when there are multiple pages
man 5 passwd                                                   # โœ…

# Use whatis to find the section
whatis passwd                                                  # โœ…

# Use apropos when the command name is unknown
apropos "copy file"                                            # โœ…

# Use --help for a quick summary
ls --help                                                      # โœ…

# Use man -k for keyword search
man -k "recursive copy"                                        # โœ…

# Search within a man page
/pattern                                                       # โœ…

โŒ Don’t Do This:

# Don't assume -h means help
ls -h  # human-readable, not help                               # โš ๏ธ

# Don't assume --help exists for every command
somecommand --help  # may fail                                  # โš ๏ธ

# Don't forget the section for file formats
man passwd  # shows the command, not the file format           # โš ๏ธ

# Don't memorize when you can look up
# The exam allows man pages                                    # โœ…

# Don't use online docs for the installed version
# The local man page is authoritative                          # โš ๏ธ

# Don't skip the SEE ALSO section
# It lists related commands                                    # โœ…

# Don't ignore the EXAMPLES section
# It shows the common usage                                    # โœ…

Common Pitfalls

PitfallWhy It HappensFix
Wrong page shownMultiple sectionsUse man N command
Command not found in manNot in the databaseUse --help or search online
apropos returns nothingDatabase not builtRun sudo mandb
--help failsCommand does not support itUse man
-h is not helpCommand-specific flagCheck the man page
Page too long to scanNo searchUse /pattern to find options
Section unknownNot documentedUse whatis

Real-World Examples

1. Basic man

man ls

2. File Format Page

man 5 fstab

3. System Admin Command

man 8 mount

4. Find a Command

apropos "disk usage"

5. Short Description

whatis tar

6. Search the Page

man tar
# then type: /--exclude

7. Quick Help

tar --help

8. Info Page

info coreutils

9. Path to Page

man -w grep

10. Search All Pages

man -K "recursive"

Visual

Manual Page Structure

โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚  LS(1)                    User Commands                   LS(1)โ”‚
โ”‚                                                             โ”‚
โ”‚  NAME                                                       โ”‚
โ”‚         ls - list directory contents                        โ”‚
โ”‚                                                             โ”‚
โ”‚  SYNOPSIS                                                   โ”‚
โ”‚         ls [OPTION]... [FILE]...                            โ”‚
โ”‚                                                             โ”‚
โ”‚  DESCRIPTION                                                โ”‚
โ”‚         List  information  about  the FILEs (the current    โ”‚
โ”‚         directory by default).                              โ”‚
โ”‚                                                             โ”‚
โ”‚  OPTIONS                                                    โ”‚
โ”‚         -a, --all                                           โ”‚
โ”‚                do not ignore entries starting with .        โ”‚
โ”‚         -l     use a long listing format                    โ”‚
โ”‚         -h, --human-readable                                โ”‚
โ”‚                with -l, print sizes like 1K 234M 2G         โ”‚
โ”‚                                                             โ”‚
โ”‚  SEE ALSO                                                   โ”‚
โ”‚         Full documentation <https://www.gnu.org/...>        โ”‚
โ”‚         or available locally via: info '(coreutils) ls...'   โ”‚
โ”‚                                                             โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

Manual Sections

โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚  SECTION 1: User Commands                                   โ”‚
โ”‚  ls, cp, mv, grep, find, tar                                โ”‚
โ”‚                                                             โ”‚
โ”‚  SECTION 5: File Formats                                    โ”‚
โ”‚  passwd, fstab, hosts, crontab                              โ”‚
โ”‚                                                             โ”‚
โ”‚  SECTION 8: System Administration                           โ”‚
โ”‚  mount, useradd, systemctl, iptables                        โ”‚
โ”‚                                                             โ”‚
โ”‚  A command can have pages in multiple sections.             โ”‚
โ”‚  man passwd   โ†’ section 1 (the command)                     โ”‚
โ”‚  man 5 passwd โ†’ section 5 (the file format)                 โ”‚
โ”‚                                                             โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

Finding the Right Page

โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚  Command name unknown?                                      โ”‚
โ”‚    โ””โ”€โ”€ apropos "keyword"                                    โ”‚
โ”‚                                                             โ”‚
โ”‚  Command name known, section unknown?                       โ”‚
โ”‚    โ””โ”€โ”€ whatis command                                       โ”‚
โ”‚                                                             โ”‚
โ”‚  Section known?                                             โ”‚
โ”‚    โ””โ”€โ”€ man N command                                        โ”‚
โ”‚                                                             โ”‚
โ”‚  Quick summary?                                             โ”‚
โ”‚    โ””โ”€โ”€ command --help                                       โ”‚
โ”‚                                                             โ”‚
โ”‚  Full GNU documentation?                                    โ”‚
โ”‚    โ””โ”€โ”€ info command                                         โ”‚
โ”‚                                                             โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

man Navigation

โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚  man ls                                                     โ”‚
โ”‚                                                             โ”‚
โ”‚  โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”    โ”‚
โ”‚  โ”‚  Space    โ†’ next page                               โ”‚    โ”‚
โ”‚  โ”‚  b        โ†’ previous page                           โ”‚    โ”‚
โ”‚  โ”‚  /pattern โ†’ search forward                          โ”‚    โ”‚
โ”‚  โ”‚  ?pattern โ†’ search backward                         โ”‚    โ”‚
โ”‚  โ”‚  n        โ†’ next search match                       โ”‚    โ”‚
โ”‚  โ”‚  N        โ†’ previous search match                   โ”‚    โ”‚
โ”‚  โ”‚  g        โ†’ go to beginning                         โ”‚    โ”‚
โ”‚  โ”‚  G        โ†’ go to end                               โ”‚    โ”‚
โ”‚  โ”‚  q        โ†’ quit                                    โ”‚    โ”‚
โ”‚  โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜    โ”‚
โ”‚                                                             โ”‚
โ”‚  The pager is less. The keys are less keys.                 โ”‚
โ”‚                                                             โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

Summary

CommandPurpose
man commandShow the manual page
man N commandShow section N
man -k keywordSearch descriptions
man -f commandShort description
man -a commandAll matching pages
man -w commandPath to the page
apropos keywordSearch descriptions
whatis commandShort description and section
command --helpQuick usage summary
info commandGNU hypertext documentation

Key takeaways:

  • man is the primary documentation interface. It displays the manual page in a pager. The page has a consistent structure: NAME, SYNOPSIS, DESCRIPTION, OPTIONS, FILES, SEE ALSO. The SYNOPSIS uses conventions for optional and repeatable arguments.
  • The manual is divided into sections. Section 1 is user commands, section 5 is file formats, section 8 is system administration. A command can have pages in multiple sections. Use man N command to specify the section.
  • whatis shows the section. The output lists the command, the section in parentheses, and the description. Use it to determine which section to read.
  • apropos searches the descriptions. It is the tool to use when the command name is unknown. man -k is equivalent. The database is built by mandb.
  • --help is a quick summary, not a substitute for man. It is faster but not standardized. Some commands do not support it. The man page is always available.
  • info is the GNU hypertext documentation. It is more detailed than the man page for GNU tools. The navigation keys are different from less.
  • The local documentation is authoritative. The man page on the system reflects the installed version. Online documentation may be for a different version.

Remember: The LFCS allows documentation. The man pages are installed on the exam system. The skill the exam rewards is not memorization but the ability to find the answer. Use man for the full documentation. Use the section when there are multiple pages. Use whatis to find the section. Use apropos when the command name is unknown. Use --help for a quick summary. Use info for GNU tools. And use /pattern to search within a page. The commands are the answers, and the documentation is how you find them.



Stop using slow, ad-bloated tool sites! ๐Ÿคฎ

๐Ÿ”Ž Search “KandZ Tools” on Google to use many professional utilities for free.

KandZ.me is the ultimate minimalist hub for:
โœ… Finance (Mortgage, Interest, Inflation)
โœ… Tech (Base64, JSON, Dev Suite, IP)
โœ… Health (BMI, BMR, TDEE)
โœ… Productivity (Timer, Workspace, QR)

โšก๏ธ Fast & Private
๐Ÿ”’ No data leaves your device
๐Ÿ’Ž 100% Free

๐Ÿ”— Use it now: https://tools.kandz.me
๐Ÿ”– Bookmark itโ€”youโ€™ll need it later!