Here comes your man!

The man command, often ignored or tossed aside by more experienced users, reveals itself as one of the more important help channels, in the command line, because it provides documentation for commands on your system, since almost every command has a manual that rests waiting for you to read it. This manuals are commonly called man pages.

Man pages are divided into several sections, which include:

  1. Executable user programs or 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

Single man pages are also composed by a few sections, which describe the usage of the target command, that include, but are not limited to:

  • NAME - name and a short description off what the object command does
  • SYNOPSIS - list of available options to use in the command line
  • DESCRIPTION - description (long or short) of the command
  • OPTIONS - a detailed explanation of the options switches used in that command
  • EXAMPLES - some examples on using
  • FILES - optional files associated with the target command
  • SEE ALSO -list of man pages to read for more information
  • BUGS - known bugs for that command (not fixed or part of the command design)
  • AUTHOR - self explanatory =)

In Linux, everything has a place, and man pages are no different! They (normally) reside in /usr/share/man and the corresponding sections 1 to 9, are the child directories:

/usr/share/man/man[1-9]

So now that you know about the theory, lets apply it! Man pages are good when you are stuck and need to know more information about a command, or simply for learning and self preparation.

For example, typing “man ls“, puts you inside a man page where you can scroll up and down and read it freely, or you can make searches by typing “/ + <string to search>” . Its really easy! It finds what you search, and you can go to the next result by pressing N, or to the previous result, by pressing B. You can quit this man page by simpling typing Q.

man ls

There is also a smart way to use man. If you type “man -k <command>” it outputs a list of man pages that reside on the system, with that pattern. So if you type man -k cron, the output will include everything indiscriminately, which include cron, crontab, vixie-crontab, etc…
man -k cron

As you probably notice, there are number, in front of each entry… guess what? Remember those sections I told you about? That’s it, they are sections! So, in the example used, cron has a (1) and a (5) which correspond to users commands and file formats, correspondingly. So if you type cron 5 crontab you will enter the files formats section of crontab man page!! Pretty cool hey?

You can also search for man pages using the -a option of the man command. With this you can visualize all the man pages you search for, and each time you press Q inside one, it will quit and go to the next, until there are no more. Both -a and -k of man use the whatis (remember last post?) database.

Explore around the man command. Try different commands, learn something new, and explore some more! Now you got the tools to get help in the CLI, without asking others, or going on-line. Anything, I’m glad to help anyone! Happy readings!



   Share This

0 comments ↓

There are no comments yet...Kick things off by filling out the form below.

Leave a Comment

Creative Commons License
dbugs.org by Marco Garcês is licensed under a Creative Commons Attribution-Noncommercial-No Derivative Works 3.0 Unported License.