Using the apropos command on Linux

# man -k updatedb
updatedb.conf (5)    - a configuration file for updatedb(8)
updatedb (8)         - update a database for plocate

In the following example, I searched on the word “halt” and found a series of related commands.

# apropos halt
halt (8)             - Power off, reboot, or halt the machine
poweroff (8)         - Power off, reboot, or halt the machine
reboot (8)           - Power off, reboot, or halt the machine
shutdown (8)         - Halt, power off or reboot the machine
systemd-halt.service (8) - System shutdown logic

Here’s an interesting set of commands that suggest that apropos may sometimes find more than you want to see. I searched on the term “host” and noticed that some of the returned descriptions included “ghost” instead of “host”. Whenever this kind of problem pops up, add the -e option to get an exact (whole word) match. Notice the difference in the response when I use this option. The second command below only counts commands when the description includes “host” as a complete word.

$ apropos host | wc -l
142
$ apropos -e host | wc -l
78

One of the problems you might encounter is when the apropos command responds with “nothing appropriate” regardless of what term you ask about. This means that man pages need to be created or updated.



Source link