1

I'm trying to use apropos so that I would look for all man pages starting with system.

I try:

apropos ^system
apropos "^system"

but these seem to return lines that don't start with system, but where system occurs somewhere in the line.

Any ideas?

Edit

As per comment below, the above actually works but it matches against several compoments:
- cmd name
- cmd description - cmd one liner.

So when I searched for system, I got a line like this:

tapset::task_time (3stap) - systemtap task_time tapset

Which makes sense because the description starts with system.

One way to get really just the lines starting with "system" would be:

apropos "" | grep "^system"
  • 1
    Running apropos '^system' works for me, returning the list of man pages where either the page name itself starts with system or the one line description starts with system. For example, the output includes system-config-printer (1) - configure a CUPS server and sigset (3) - System V signal API. This is on Debian (jessie). – roaima Jul 14 '15 at 14:10
  • Oh, it matches regex on several components (cmd name/description), I didn't know this and was confused why it seemingly didn't work. This makes sense. I would happily accept your comment as an answer? – Leo Ufimtsev Jul 14 '15 at 14:17
4

Running apropos '^system' works for me, returning the list of man pages where either the page name itself starts with system or the one line description starts with system.

For example, the output on Debian (jessie) includes:

system-config-printer (1) - configure a CUPS server
sigset (3) - System V signal API

I know of no clean way to tell apropros to search only in page names or in the one-line description, but there's always grep:

apropos system | grep -- '^system'    # page names
apropos system | grep -- '- system'    # descriptions

Either of these can be encapsulated in a shell function such as this:

apro() { apropos "$1" | grep -- "^$1"; }
2

The apropos command searches both names and descriptions. But results could be filtered:

apropos system | grep "^system"
  • This is a correct answer. The only reason I accepted the other one is it's a bit more complete. Thank you for your effort thou :-). – Leo Ufimtsev Jul 14 '15 at 14:27

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.