Getting Info about Commands
Brush up on how to get information about bash commands via command line.
man
Definition:
man
is used to format or display the manual pages. Manual pages or man pages are the official documentation of all shell commands that comes along with the Linux distributions.
Syntax:
man [option(s)] keyword(s)
In order to display manual page from specific section:
man [section-num] [command/tool name]
Section Numbers:
Section No. | Section Description |
---|---|
1 | Programs or shell commands |
2 | System calls (functions provided by the kernel) |
3 | Library calls (functions within program libraries) |
4 | Special files (usually found in /dev) |
5 | File formats and conventions eg /etc/passwd |
6 | Games and demonstrations |
7 | Miscellaneous (including macro packages and conventions), e.g., man, groff |
8 | System administration commands (usually only for root) |
9 | Device driver interfaces |
Options:
Option | Syntax | Meaning |
---|---|---|
-s | man <section num> <command> |
To specifically view a section of a man page. |
-a | man -a <command> |
To display all manual pages where a command exists. |
-w | man -w [command/tool name] |
To view the location for man pages. |
-I | man -I [command/tool name] |
To enable case-sensitivity while searching for man pages |
-H | man -H[browser-command] [command/tool name] |
To display manual pages in web browser. |
-f | man -f [command/tool name] |
To lookup for manual pages and display short descriptions as well. |
Example:
To get information about the ls
command:
man ls
Get hands-on with 1400+ tech skills courses.