apropos command helps users find any command using its man pages. Man pages describe command functions, list applicable arguments, and provide use-case examples.
The man command invokes Linux command manual with the
man command_name syntax. Therefore, not knowing the command name creates a problem. Unlike
apropos searches all man pages using known details as a search term.
This guide offers
apropos Linux command explained (with examples).
- A system running Linux.
- Access to the terminal.
apropos command is case insensitive.
Linux apropos Command Syntax
apropos syntax is:
apropos [option] keyword
apropos command works without options but does not work without a search term (keyword).
Linux apropos Command Options
apropos command works without any arguments. Still, options customize the output or affect the search process.
Some standard options are:
|Returns names and descriptions that match the keyword exactly.
|Prints debugging messages.
|Searches for the keyword with wildcards.
|Functions as logical AND. Returns output when all the keywords match.
|Stops output trimming.
|Uses user-configuration files instead of the $
|Searches only in specific man pages sections.
|Sets the search path to PATH rather than the default $
|Looks for man page descriptions from other OSs.
|Sets the locale for the search.
|Interprets each keyword as a regex.
apropos Linux Command Examples
Searching a command by a keyword is handy when you cannot remember an exact command or when you try to find a suitable command to complete an action.
apropos helps in these situations and has plenty of use cases. Some examples are listed below.
Find a Keyword
apropos primary usage is to find a single keyword in man pages. For instance, run
apropos list to find instances mentioning the keyword list:
The command prints all instances of list in names (marked in green) and descriptions (marked in yellow). The tool also shows matches belonging to larger strings, like listener or lists.
Search Two Keywords
When the keyword is too broad,
apropos outputs a lot of results. For list,
apropos prints 300 lines.
Add another variable to narrow down the matches. For instance, to list all the directories, use two keywords with
apropos: list and directories.
apropos -a list directory
Achieve a similar effect without
-a. by encasing keywords in double quotes:
apropos "list directory"
Double quotes instruct
apropos to find the exact match, with the same order as keywords in quotes. Hence, the output provides four lines as opposed to six when using
Find Either of Two Parameters
-a argument functions as logical AND, running
apropos with several search terms without arguments functions as logical OR.
For instance, use delete, terminate, and remove as search terms to find man pages including either of the keywords:
apropos delete terminate remove
apropos command prints lines containing one or more keywords.
Find Exact Match
apropos matches individual keywords or as part of another word. For example:
The output shows instances of set included in strings like offset and settings. To find exact matches for set, use the
apropos -e set
Search Specific Sections
A man page for each command consists of nine sections. For example:
apropos searches for the keyword in any section. To specify the manual section to search for, use
-s followed by the section number(s).
For instance, search for list in sections 1 and 8 with the following command:
apropos -s 1,8 list
The command printed man pages containing list in sections 1 or 8.
Use Regex Symbols
Use regex symbols to speed up the search process and filter the results.
For instance, find all man pages starting with the word list with:
The keyword list is enclosed in single quotes with the caret symbol, ensuring that the term appears at the beginning of the line. The output shows that list appears at the beginning of the name column or the description column.
Regex expressions offer even more options. For example, find every man page that includes zipcloak, zipnote, or zipinfo with:
The pipe functions as logical OR. The
apropos command searches for zip with the cloak, note, or info suffix.
Use regex to conduct an even more specific search. For instance, find implementation, devices, or users in sections 3 or 8 on any man page that starts with list:
apropos -a -s 3,8 "^list" "(implementation|devices|users)"
As the output shows, each line includes list at the beginning, belongs to section 3 or 8, and has one of the keywords.
apropos command trims the description in output by default. The output is shown ending in an ellipsis. When running
list, the trimming is evident in some places:
Trimming is present despite the window size. To avoid the trimming, use the
After following this tutorial, you know how to use the
apropos command to search through different man pages.
Next, check out the ultimate list of Linux commands all users should know.
Đăng ký liền tay Nhận Ngay Bài Mới
Cám ơn bạn đã đăng ký !
Lỗi đăng ký !