Detailed Usage of the Linux apropos Command

Introduction

<span><span>apropos</span></span> is a fuzzy search tool that can search for input keywords in all <span><span>man</span></span> pages. Compared to <span><span>whatis</span></span>, which can only search command names, <span><span>apropos</span></span> can also search descriptions.

Common Options

  • <span><span>-e, --exact</span></span>: Returns names and descriptions that exactly match the keyword

  • <span><span>-d</span></span>: Print debug messages

  • <span><span>-w, --wildcard</span></span>: Use wildcard to search for keywords

  • <span><span>-a, --and</span></span>: Functions similarly to logical AND. Returns output when all keywords match

  • <span><span>-l, --long</span></span>: Output without truncation

  • <span><span>-C</span></span>: Use user profile instead of <span><span>$MANPATH</span></span>

  • <span><span>-s</span></span>: Search only in specific sections of the manual pages.

  • <span><span>-M</span></span>: Set the search path to <span><span>PATH</span></span> instead of the default <span><span>$MANPATH</span></span>

  • <span><span>-L</span></span>: Set the locale for the search

  • <span><span>-r, --regex</span></span>: Interpret each keyword as a regular expression

  • <span><span>-d</span></span>: Print <span><span>debug</span></span> information

  • <span><span>-v</span></span>: Print detailed warning messages

Example Usage

Basic Usage

apropos "list"

**Example Output

ls (1)               - list directory contents
dir (1)              - list directory contents
nmcli (1)            - command-line tool for controlling NetworkManager

Search Multiple Words (default is OR relationship)

apropos "list copy"

Search Multiple Words with Logical AND Matching

apropos -a list directory

Exact Match

apropos -e set

Search in Specific Sections

Search in sections 1 and 8

apropos -s 1,8 list

Search Using Regular Expressions

Find all manual pages that start with the word <span><span>list</span></span>.

apropos '^list'

Regular Expression Implementing OR Relationship

apropos "zip(note|cloak|info)"

Combining Multiple Options

apropos -a -s 3,8 "^list" "(implementation|devices|users)"

Avoid Truncation

By default, descriptions in the output are trimmed, ending with ellipses

apropos -l list

whatis vs apropos

Functionality whatis apropos
Search Command Names
Search Descriptions
Match Fuzzy Content
Exact Match

Please open in the WeChat client

Leave a Comment