Search code examples
linuxterminalmanpage

How to get the man page of an option of a command?


I want to jump straight to the description of an option of a command. Something like man ls -la or gcc -g or cat -n etc. you get it. Is there a way to do that?


Solution

  • What I typically do is in a man page hit /, and then type something to search.

    Or if you want to jump directly to a section you could use man --pager. For example, if you wanted to go to the section about -h of ls you could do man --pager='less -p -h' ls. This could easily be made into a little bash script if you want to use this all the time.

    If you want to jump directly to a section, and avoid hangups add 4 spaces in front of the section like so, man --pager='less -p " -h"' ls.