Linux Man

Education is not limited to just classrooms. It can be gained anytime, anywhere... - Ravi Ranjan (M.Tech-NIT)

Linux Man Command

The "man" is a short term for manual page. In unix like operating systems such as linux, man is an interface to view the system's reference manual.

A user can request to display a man page by simply typing man followed by a space and then argument. Here its argument can be a command, utility or function. A manual page associated with each of these arguments is displayed.

If you will provide a section number in the command, then man will be directed to look into that section number of the manual and that section page will be displayed. And if not, then by default it will display the first page and you have to go through the entire sections in a pre-defined manner.

We'll read about section number in this tutorial.

Syntax of man:

  1. man [option(s)] keyword(s)  

But generally [option(s)] are not used. Only keyword is written as an argument.

For example,

man ls 

This command will display all the information about 'ls' command as shown in the screen shot.

Linux man1


How Output is Displayed in Command Shell

man display its output through pager. A pager is a program that displays its output one screenfull at a time, means whole text doesn?t appear at once and there is no option to scroll down the page.

A colon at the bottom displays end of the on-screen page. To go to the next page you can use ?space bar' or 'f' and to go backward page you can use 'b'.

To exit from the on-screen page use 'q' and you will be directed to the shell program. And for help press 'h'.


Sections in the man Page:

man page is divided into different sections. Each section is divided based up on a particular topic.

The man pages have a number written in the parentheses after the command. These number represent the section number. In the above picture, you can see LS(1) at the top, which shows that it is from section 1.

As I stated earlier, if you will mention a particular section number then your man page will be directed to that section. Or else, you have to go through the whole sections in a pre-defined manner to go to your desired section.

Sections:

  1. Executable programs and shell commands
  2. System calls
  3. Library calls
  4. Special files
  5. File formats and conventions
  6. Games
  7. Miscellaneous
  8. System administration commands
  9. Kernel routines

n. Tcl/Tk (a programming language)

Syntax for a particular section:

man section_number keyword 

For example

man 2 passwd

man Options

Commands Function
man -aw List all available sections of a command.
man -a To view all man pages of a command.
sman -k (apropos) Shows a list of results in man page containing a keyword match.
-f, whatis It displays description from manual page if available.
whereis Used to determine location of a man page