Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to read Linux man pages? [closed]

Tags:

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?

like image 271
cizixs Avatar asked Mar 12 '14 05:03

cizixs


2 Answers

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

like image 116
shivams Avatar answered Sep 20 '22 23:09

shivams


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

like image 27
Laxmikant Ratnaparkhi Avatar answered Sep 20 '22 23:09

Laxmikant Ratnaparkhi