A better usage of apropos for searching the man directory

bashcatalinacommand linemojaveterminal

I will ask my question starting from a real example.

From the command line prompt, I want to search for a command line tool that will output information about my smart card.

Side Note: I already know that the command line tool that I am looking for is the system_profiler SPSmartCardsDataType but let's pretend I do not know yet.

Step #1
From the command line prompt I type the following: apropos smart card

Step #2
I receive the following result:

SmartCardServices(7)     - overview of SmartCard support
SmartCardServices-legacy(7) - overview of legacy SmartCard support
com.apple.ifdreader(8)   - SmartCard reader daemon
ctkahp(8)                - SmartCard Agent
ctkbind(8)               - SmartCard pairing tool
ctkd(8)                  - SmartCard daemon/agent
pam_smartcard(8)         - Smartcard PAM module
ssh-keychain(8), ssh-keychain.dylib(8) - smartcard/keychain support library

And of course I can use the SmartCardServices command line tool but this is not what I am looking for.

Question: How can I make a better search for a specific command line tool? I guess a search that will query the command line options too?

In my specific case if I search for the keyword smart card why the output does not show me at least the term system_profiler?

I hope I was clear, if not let me know and I can rephrase my question. Once again, the above it is just an example, I use SmartCard because this is what I had issue in searching today, but it can be anything else.

Best Answer

apropos just looks in the command description, not the full man page. There are no specific commands to "intelligently" search within all man pages, but in a bind you can always run

cd /usr/share/man
zgrep -i smartcard man*/*

PS: This won't help for system_profiler though because the data types supported aren't listed in the man page at all.