Search the Manual Page Index for String Matches in Terminal for Mac OS X
Many command line users are familiar with the ‘man’ command that will open a manual page for a specific command, but what if rather than a specific commands man page, you’re looking for a string match within all man pages? That’s what this tricks is for, so whether you’re trying to learn more about a specific process, daemon, configuration file, or whatever else, the Terminal app of OS X includes a really nifty quick search feature that allows users to instantly search the man page index for all matches.
Searching Manual Pages for String Matches in Mac OS
Using the man page index search is about as easy as it gets as far as the Terminal app is concerned, and you don’t even need to enter a command (though you can if you want to, more on that in a moment).
- Select a block of text, syntax, a command, configuration file, log, system daemon, process with the cursor, then right-click and choose “Search man Page Index”
For this example, we’re searching all manual pages for ‘syslogd’, which is the system log server in OS X, and the three man page results are found: asl.conf, syslog.conf, and syslogd.
This is actually just a GUI front-end to the excellent apropos command, which is one of a variety of ways to get additional command details or find help from the command line. If you wanted to access that directly without using the right-click trick as mentioned above, you could use the same with syslogd by typing the following into the command line:
apropos syslogd
The matched results will be the same, which is basically a list of ‘whatis’ matches to man, except that a new terminal window with the yellow manual page formatting will not launch, the results will be returned into the same window as where the command was launched like any other terminal syntax.
Directly above this is the open man page menu option in the same contextual menu, which can also be useful to quickly get additional details or open the specific manual pages referenced by what the apropos command has returned. From the GUI standpoint, the Terminal app Help menu offers the same ability to launch manual pages into new windows. These are great tricks to know for newcomers to the command line, and even for those who are longtime unix masters but who just like to know easy ways to access something they may use often.
man who has time to do this? my abs be flabbin’ so i need to do some burpees and kettle squats STAT. horowitz, do you even lift bro?
Good to know, but I find man pages lacking the details that are often needed to implement a collared string properly