How to read Linux man pages?

cizixs picture cizixs · Mar 12, 2014 · Viewed 9.8k times · Source

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?

Answer

shivams picture shivams · Jan 26, 2015

Being Productive in reading man pages

Apart from LaxmiKant's answer, I would like to add something more 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 markers. 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 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