Kiến Thức Linux

apropos Linux Command Explained {with Examples}

apropos Linux Command Explained {with Examples}


The 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 man, apropos searches all man pages using known details as a search term.

This guide offers apropos Linux command explained (with examples).

apropos Linux Command Explained {with Examples}


  • A system running Linux.
  • Access to the terminal.

Note: The apropos command is case insensitive.

Linux apropos Command Syntax

The basic apropos syntax is:

apropos [option] keyword

The apropos command works without options but does not work without a search term (keyword).

Since apropos searches for a keyword in names and descriptions of man pages, running the command without a keyword prints the following:

apropos terminal output

Linux apropos Command Options

The apropos command works without any arguments. Still, options customize the output or affect the search process.

Some standard options are:

Option Description
-e Returns names and descriptions that match the keyword exactly.
-d Prints debugging messages.
-w Searches for the keyword with wildcards.
-a Functions as logical AND. Returns output when all the keywords match.
-l Stops output trimming.
-C Uses user-configuration files instead of the $MANPATH.
-s Searches only in specific man pages sections.
-M Sets the search path to PATH rather than the default $MANPATH.
-m Looks for man page descriptions from other OSs.
-L Sets the locale for the search.
-r 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

The apropos primary usage is to find a single keyword in man pages. For instance, run apropos list to find instances mentioning the keyword list:

apropos list
apropos list terminal output

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.

Without arguments, apropos searches man pages that include list or directory. To ensure the output includes both, use -a:

apropos -a list directory
apropos -a terminal output

Achieve a similar effect without -a. by encasing keywords in double quotes:

apropos "list directory"
apropos 'list directory" terminal output

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 -a.

Find Either of Two Parameters

While the -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 three keywords terminal output

The apropos command prints lines containing one or more keywords.

 Find Exact Match

The apropos matches individual keywords or as part of another word. For example:

apropos set
apropos set terminal output

The output shows instances of set included in strings like offset and settings. To find exact matches for set, use the -e flag:

apropos -e set
apropos -e terminal output

Search Specific Sections

A man page for each command consists of nine sections. For example:

man man
man sections

By default, 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
apropos -s terminal output

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:

apropos '^list'
apropos caret list terminal output

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:

apropos "zip(note|cloak|info)"
apropos regex piping terminal output

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)"
apropos long regex command terminal output

As the output shows, each line includes list at the beginning, belongs to section 3 or 8, and has one of the keywords.

Avoid Trimming

The apropos command trims the description in output by default. The output is shown ending in an ellipsis. When running apropos with list, the trimming is evident in some places:

apropos trimming terminal output

Trimming is present despite the window size. To avoid the trimming, use the -l option:

apropos -l no trimming terminal output


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

Subscribe ngay

Cám ơn bạn đã đăng ký !

Lỗi đăng ký !

Add Comment

Click here to post a comment

Đăng ký liền tay
Nhận Ngay Bài Mới

Subscribe ngay

Cám ơn bạn đã đăng ký !

Lỗi đăng ký !