How to search the manual pages (Man) via the command line -


Post Top Ad

Post Top Ad

Monday, 29 August 2016

How to search the manual pages (Man) via the command line

Referencing a manual page can be essential when it comes to learning a syntax or how a command works, but how big it can become some pages, can be a real brake travel the entire page to try to find a relevant portion. In addition, sometimes just you do not know exactly what page you should find the necessary data. Fortunately there are two tools to search for man pages and quickly find and access exactly what you want.

What is Man:

Some of the commands you probably know come from Terminal manual pages (or Man) and these pages are the equivalent of a support system for the command line. In fact, Man itself is an order, whose function is to format and display this documentation.

How to search all man pages for a string matching

If you want to find something about a general command, function, or feature, but you're not sure which page Man is what you need, or perhaps want to find all references to something, you can use this command:

Man -K "Search Term"

Where it says "search term" you must put the term you want to find. For example, to find all the manual pages that contain the string "eraseDisk" uses the syntax:

  Man -K "eraseDisk" 

Will deliver the following results:

  Man -K "eraseDisk"
 / Usr / share / man / man3 / Common Crypto.3cc?  [Ynq] n
 /usr/share/man/man8/diskutil.8?  [Ynq] and 

Presses the return key and immediately begin to search all manual pages in / usr / share / man / * and when a match is found, it will display a report that provides the page of the manual you can accept with 'and' or refuse to n (or exit with 'q')

Search on the current page for matches:

Once you're on a page, you may want to search within the same chain coincidence. This is done with /:

/ "Search term"

Example for launchd Manual:

  / LaunchAgents 

any matches will be highlighted syntax on the current page. Then you can navigate between matches ny shift + n.


Three tricks to remember a search when you are within a manual page:

  •     / "" Search term "" - find matches for a "search string" Man on the current page "
  •     No - go to the next match
  •     Shift + n - goes to the previous occurrence 

No comments:

Post a Comment

Post Top Ad