There are thousands of Linux commands and to remember each of those would be tough for anyone. Apart from that, one may not be aware about a particular command in first place. At times, specific Linux commands would get things done faster. So, in this article we cover apropos command which helps us search Linux commands.
What apropos does is, it looks for the search term in the man page name and description. And, would return with a list of all those commands which contains that specific search term.
man pages are the manual pages of a program. These pages describe a program and its options in detail. But, to access that we need to know name of the command first. Otherwise, we wouldn’t know where to look.
Now, let’s understand this with the help of an example. If we are looking for all the commands which could help us list a directory. Then, we could use a search term – “list directory”. It would look for the specific search term in all the man pages of the Linux commands. In whichever commands’ man page/description it finds the term, would be returned.
Search Linux commands with apropos
If we want to get all the commands which have a specific keyword in man pages description. Then,
apropos [options] <keyword>
For instance, if we want to list all the commands with “list” keyword then –
apropos list
It shows about 230 commands. But, to specifically get only those commands which have “list directory” keyword.
apropos "list directory"
This time it would show around four commands.
We can also use the following combination to get commands which contains some text between two keywords.
apropos "move .* file"
We can also combine two keywords with -a option,
apropos move -a file
Here, it would show the commands whose man pages descriptions would contain both move and file keywords.
To get a list of all commands whose name or description starts with list keyword then,
apropos ^new
In conclusion, we have covered how to search Linux command with apropos command-line utility here.