22

Every time I find some command confusing, I'd reach out for man pages. Sometimes I get what I want with it, but mostly it confused me even more.

I understand that a man page is divided into parts: NAME, SYNOPSIS, DESCRIPTION, OPTIONS, EXPRESSIONS, EXAMPLES, etc. But I have no clue what all the options mean. Like, how many parameters every option should have, their dependencies etc.

Can someone please clarify it for me?

Are there any documents for this?

Matthias Braun
  • 32,039
  • 22
  • 142
  • 171
cizixs
  • 12,931
  • 6
  • 48
  • 60
  • 9
    Maybe reading `man man` might help you. – devnull Mar 12 '14 at 05:16
  • Stack Overflow is a site for programming and development questions. This question appears to be off-topic because it is not about programming or development. See [What topics can I ask about here](http://stackoverflow.com/help/on-topic) in the Help Center. Perhaps [Super User](http://superuser.com/) or [Unix & Linux Stack Exchange](http://unix.stackexchange.com/) would be a better place to ask. – jww Aug 19 '18 at 08:25
  • https://unix.stackexchange.com/q/193815/34720 –  Apr 08 '19 at 20:56
  • and downvoted for good measure. – tink Jun 24 '19 at 21:24

4 Answers4

13

Being productive in reading man pages

Apart from Laxmikant's answer, I would like to add something which will actually make you faster and more productive while reading man pages.

You can use various Vim-like keybindings to navigate faster.

A few quintessential examples:

  • Press / and then type some keyword you want to search for and then press enter. It will highlight the first result. Then, you can go to the next search result by pressing n and back by Shift+n

  • If you are reading a very long page, and you need to switch back and forth between a few sections, use marks. Let us say, I am at a certain position of the man page. To mark the position, I press m and followed by some key, say 1. Now, the position is saved at mark 1. If I scroll somewhere else and I need to revisit this position, I simple press a followed by 1.

  • Use d and u for scrolling half a page down/up.

And remember, to escape from any command/mode mentioned above, the key is esc, of course.

UPDATE: Using Vim for reading man pages

To be even more productive, you could directly use Vim, like:

man ls | vi -

Or even better, define a function in your ~/.bashrc file (in case you're using Bash):

vman() { vim <(man $1); }

Source: https://stackoverflow.com/a/25057995/1359467

Matthias Braun
  • 32,039
  • 22
  • 142
  • 171
shivams
  • 923
  • 12
  • 27
  • 4
    Good advice. It might be nice to add `b` to go `back` (up) a page, and `1G` to return to the top. Also, if you don't know the actual name of the command you want, but say, you know it is related to `USB` you can do `man -k USB` to get a list of suitable pages. – Mark Setchell Jan 26 '15 at 14:25
  • Also there's different keybinds for man. While in Debian to scroll one line down/up you have to press like in vim `j`/`k`, in Ubuntu the keys like in Emacs `C-n`/`C-p`. You may want to add how to configure vim-like keys in man as it easier to press. – Hi-Angel Feb 12 '15 at 18:56
  • 1
    Very useful. The difference comes from different pagers I believe, and thus not part of man. Using vim for man makes it much more productive.+ – Boyang Jan 27 '16 at 15:56
7

All man pages follow a common layout that is optimized for presentation on a simple ASCII text display, possibly without any form of highlighting or font control. Sections present may include:

NAME

The name of the command or function, followed by a one-line description of what it does.

SYNOPSIS

In the case of a command, a formal description of how to run it and what command line options it takes. For program functions, a list of the parameters the function takes and which header file contains its definition.

DESCRIPTION

A textual description of the functioning of the command or function.

EXAMPLES

Some examples of common usage.

SEE ALSO

A list of related commands or functions. Other sections may be present, but these are not well standardized across man pages. Common examples include: OPTIONS, EXIT STATUS, ENVIRONMENT, BUGS, FILES, AUTHOR, REPORTING BUGS, HISTORY and COPYRIGHT.

See also Wikipedia on Man page

Jonathan Leffler
  • 730,956
  • 141
  • 904
  • 1,278
Laxmikant Ratnaparkhi
  • 4,745
  • 5
  • 33
  • 49
4

If you want to read man pages, maybe the articles from The Linux Journal on Getting help on Linux — Part 1: man pages and Getting help on Linux — Part 2: info will help you. Also we have info pages in Linux and those are more detailed than man pages... You can read the output of the following commands:

  • info man
  • info info
  • man info
  • man man

The following links are good for you too: 1 2 3 4

Jonathan Leffler
  • 730,956
  • 141
  • 904
  • 1,278
MLSC
  • 5,872
  • 8
  • 55
  • 89
1

there is no any other best thing than manual pages which can teach you using linux.another subsuttite for man pages is info command but that shows the same content as that of man. just read the man page again and again until you understand it or at end what you can do is search for examples of that command.

nikhil mehta
  • 972
  • 15
  • 30