3

Most of the times when I use apropos I don't care about system calls, library calls etc — I'm just trying to find a command I forgot the name of. Is there a way to trim down the output of apropos to show only executables and commands (section 1 of the manual) and filter out everything else?

7

Assuming you’re using the man-db version of apropos, you can specify the section you’re interested in with the -s option:

apropos -s 1 read

If you want to include administrative commands,

apropos -s 1,8 read

From man apropos:

-s list, --sections=list, --section=list

Search only the given manual sections. list is a colon- or comma-separated list of sections. If an entry in list is a simple section, for example "3", then the displayed list of descriptions will include pages in sections "3", "3perl", "3x", and so on; while if an entry in list has an extension, for example "3perl", then the list will only include pages in that exact part of the manual section.

With other versions of apropos, you can grep the results:

apropos read | grep '(1)'

or

apropos read | grep -E '\((1|8))'
2
  • Thanks a lot. It turns out the apropos shipping with macOS doesn't have any option whatsoever... and here I was wondering if I was missing something super obvious.
    – zool
    Jul 9 at 13:32
  • Ah, right, so my assumption is wrong ;-). Jul 9 at 13:37

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.