finding help, and using man
Using --help
The quickest way to get an overview of how to use a command is by running the command with the --help
option.
[root@el7_blog.local]# man --help
man, version 1.6f
usage: man [-adfhktwW] [section] [-M path] [-P pager] [-S list]
[-m system] [-p string] name ...
a : find all matching entries
c : do not use cat file
d : print gobs of debugging information
D : as for -d, but also display the pages
f : same as whatis(1)
h : print this help message
k : same as apropos(1)
K : search for a string in all pages
t : use troff to format pages for printing
w : print location of man page(s) that would be displayed
(if no name given: print directories that would be searched)
W : as for -w, but display filenames only
C file : use `file' as configuration file
M path : set search path for manual pages to `path'
P pager : use program `pager' to display pages
S list : colon separated section list
m system : search for alternate system's man pages
p string : string tells which preprocessors to run
e - [n]eqn(1) p - pic(1) t - tbl(1)
g - grap(1) r - refer(1) v - vgrind(1)
The historical Linux Programmer’s Manual
man man-pages
Man pages are categorized in different sections. The most relevant sections for system administrators are as follows:
- 1: Executable programs or shell commands
- 5: File formats and conventions
- 8: System administration commands
Section | Content Type |
---|---|
1 | User Commands |
2 | System Calls |
3 | Library Functions |
4 | Special Files |
5 | File Formats |
6 | Games |
7 | Conventions, Standards, and Miscellaneous |
8 | System Administration and Privileged Commands |
9 | Linux Kernel API |
To distinguish identical topic names in different sections, man page references include the section number in parentheses after the topic. passwd(1)
describes the command to change passwords, while passwd(5)
explains the /etc/passwd
file format for storing local user accounts.
man passwd
displays passwd(1)
by default
man 5 passwd
displays passwd(5)
/STRING
Searches forward (down) for STRING in the man page
When performing searches, STRING allows regular expression syntax.
A keyword search of man pages is performed using # man -k KEYWORD
, which displays a list of keyword-matching man page topics with section numbers.
The man -K
option performs a full-text page search, not just titles and descriptions like the # man -k
option.
Another useful man option is -f
. The command man -f
displays a short description of the item found in the man database.
[root@el7_blog.local]# man -f passwd
passwd (1) - update user's authentication tokens
passwd (5) - password file
passwd [sslpasswd] (1ssl) - compute password hashes
Update the mandb database with the mandb
command as root without any arguments.