A better usage of apropos for searching the man directory
Solution 1:
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.
Solution 2:
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?
The problem with this type of question is qualifying what constitutes “a better search.” It could be accuracy or frequency. Put another way, it would be somewhere on the line that balances quantity and quality of results.
That said, there’s only so much you’re going to get from the serarch. From the apropos man page:
Search the whatis database for strings.
The whatis
database is nothing more than a database of short descriptions of system commands. It’s not a large, complex, rational database filled with metadata for each command; it is what it is.
Using your example of “smart card,” you’re getting the results that you are because those are the commands where “smart card” shows up in the command descriptions database.
So, to get better results, you would want to be flexible with your keywords and use synonyms for the terms you’re searching for. That said....
You can output the contents of the whatis
database with this command
whatis ' ' | egrep '\(1\)'|sort
That’s it. There’s not too much to it. apropos
will search this matching keywords. If those keywords aren’t in the database, you wont get hits.