man Command Examples in Linux

Linux systems come with a wealth of documentation. For basic commands, the manual pages (or man pages) will tell you what you need to know. For example, to see the manual page for the ls command, run man as follows:

$ man ls

Most manual pages concentrate primarily on the reference information, perhaps with some examples and cross-references, but that’s about it. Don’t expect a tutorial, and don’t expect an engaging literary style.

Manual pages are referenced by numbered sections. When someone refers to a manual page, they often put the section number in parentheses next to the name, like ping(8). The table below lists the sections and their numbers.

Section Description
1 User commands
2 Kernel system calls
3 Higher-level Unix programming library documentation
4 Device interface and driver information
5 File descriptions (system configuration files)
6 Games
7 File formats, conventions, and encodings (ASCII, suffixes, and so on)
8 System commands and servers

For example, to read the /etc/passwd file description (as opposed to the passwd command), you can insert the section number before the page name like so:

$ man 5 passwd

man Command Examples

1. To see the manual for a command:

# man command
# man ls 

2. To Specify the configuration file to use; the default is /etc/man.config:

# man -C  config_file 

3. To Specify the list of directories to search for man pages:

# man -M path 

4. To Specify which pager to use:

# man -P pager 

5. To specify which browser to use on HTML files:

# man -B 

6. To Specify a command that renders HTML files as text:

# man -H 

7. To List is a colon separated list of manual sections to search:

# man -S section_list 

8. To display all the manual pages that match name:

# man -a 

9. To Reformat the source man page, even when an up-to-date cat page exists:

# man -c 

10. To don’t actually display the man pages, but do print gobs of debugging information:

# man -d 

11. To display and print debugging info:

# man -D 

12. To display in whatis format:

# man -f 

13. Just to format and not to display:

# man -F
# man --preformat 

14. To print a help message and exit:

# man -h 

15. To search for specified key in all man pages:

# man -K 

16. To specify an alternate set o man pages:

# man -m system 

17. To specify the sequence of pre-processors to run before nroff or troff:

# man -p string 

18. To use /usr/bin/groff -Tps -mandoc to format the manual page:

# man -t 

Manual pages cover the essentials, but there are many more ways to get online help (aside from searching the internet). If you’re just looking for a certain option for a command, try entering a command name followed by –help or -h (the option varies from command to command). You may get a deluge (as in the case of ls –help), or you may find just what you’re looking for.

Related Post