🔍 Linux apropos Command

Search Manual Page Names and Descriptions - Examples by Claude

What is apropos?

The apropos command searches the manual page names and descriptions for keywords. It's incredibly useful when you know what you want to do but don't know which command to use. Think of it as a "search engine" for Linux commands. The name comes from the French word meaning "appropriate" or "relevant."

Example 1Basic Keyword Search

apropos copy
Search for all commands related to "copy". This returns any manual pages that have "copy" in their name or description.
cp (1) - copy files and directories cpio (1) - copy files to and from archives dd (1) - convert and copy a file install (1) - copy files and set attributes rsync (1) - a fast, versatile, remote file-copying tool scp (1) - OpenSSH secure file copy

Example 2Search for Network Commands

apropos network
Find all commands and configuration files related to networking. Perfect when you need to troubleshoot network issues but aren't sure which tool to use.
ifconfig (8) - configure a network interface ip (8) - show / manipulate routing, devices, policy routing netstat (8) - Print network connections, routing tables ping (8) - send ICMP ECHO_REQUEST to network hosts route (8) - show / manipulate the IP routing table ssh (1) - OpenSSH SSH client (remote login program)

Example 3Exact Match Search

apropos -e ls
Use the -e (exact) flag to find only exact matches of "ls", not "lsof", "lspci", etc. This is useful when you want precise results.
ls (1) - list directory contents
Pro Tip: Without -e, apropos would also show lsattr, lsblk, lscpu, lsof, lspci, and many other commands containing "ls".

Example 4Search Multiple Keywords (OR)

apropos "compress OR archive"
Search for commands related to either compression OR archiving. The quotes are important when using OR logic.
bzip2 (1) - a block-sorting file compressor gzip (1) - compress or expand files tar (1) - an archiving utility zip (1) - package and compress (archive) files unzip (1) - list, test and extract compressed files xz (1) - Compress or decompress .xz files

Example 5Search Specific Section

apropos -s 1 user
Search only in section 1 (user commands) for "user". Manual pages are organized into sections, and this lets you narrow your search.
id (1) - print real and effective user and group IDs users (1) - print the user names of users currently logged in whoami (1) - print effective userid w (1) - Show who is logged on and what they are doing
Note: Section 1 = User commands, Section 5 = File formats, Section 8 = System administration commands

Example 6Case-Insensitive Search

apropos -i TCP
The -i flag makes the search case-insensitive. This finds "tcp", "TCP", "Tcp", etc. Useful when you're not sure about capitalization.
tcp (7) - TCP protocol netstat (8) - Print network connections (including TCP) ss (8) - another utility to investigate sockets (TCP/UDP) tcpdump (8) - dump traffic on a network

Example 7Long Format Output

apropos -l password
Use -l (long) to show full descriptions instead of truncated ones. Great when you need more context about what a command does.
passwd (1) - change user password. The passwd utility is used to update user's authentication tokens. This task is achieved through calls to the Linux-PAM and Libuser API. chpasswd (8) - update passwords in batch mode. The chpasswd command reads a list of user name and password pairs from standard input and uses this information to update a group of existing users.

Example 8Regular Expression Search

apropos -r '^ssh'
Use regular expressions with -r flag. This finds all commands starting with "ssh" (^ means start of line).
ssh (1) - OpenSSH SSH client (remote login program) ssh-add (1) - adds private key identities to the OpenSSH authentication agent ssh-agent (1) - OpenSSH authentication agent ssh-keygen (1) - OpenSSH authentication key utility sshd (8) - OpenSSH SSH daemon
Pro Tip: Regular expressions let you create powerful search patterns. Use '.*' for wildcards, '$' for end of line, etc.

Example 9Find Commands by Task

apropos "print working directory"
Search for a specific phrase in command descriptions. When you know what you want to do but not the command name, describe the task.
pwd (1) - print name of current/working directory

Example 10Search Configuration Files

apropos -s 5 config
Search section 5 (file formats and conventions) for configuration files. This is incredibly useful for finding documentation about config files.
hosts (5) - static table lookup for hostnames resolv.conf (5) - resolver configuration file fstab (5) - static information about the filesystems crontab (5) - tables for driving cron ssh_config (5) - OpenSSH SSH client configuration files

Example 11Wildcard Search

apropos -w '*stat*'
Use wildcards with -w flag to match patterns. This finds any command with "stat" anywhere in the name or description.
stat (1) - display file or file system status netstat (8) - Print network connections, routing tables iostat (1) - Report Central Processing Unit (CPU) statistics vmstat (8) - Report virtual memory statistics

Example 12Search System Administration Commands

apropos -s 8 disk
Search section 8 (system administration) for disk-related commands. Section 8 contains commands typically run by root.
fdisk (8) - manipulate disk partition table mkfs (8) - build a Linux filesystem fsck (8) - check and repair a Linux filesystem mount (8) - mount a filesystem df (1) - report file system disk space usage

Example 13Debugging apropos

apropos -d compress
Use -d (debug) to see what apropos is doing behind the scenes. Useful when troubleshooting or understanding how apropos works.
Note: Debug output shows which database files apropos searches and parsing details. Very verbose!

Example 14Combine with grep for Refined Results

apropos network | grep -i wireless
Pipe apropos output to grep for even more refined searches. This finds network commands specifically related to wireless.
iwconfig (8) - configure a wireless network interface iwlist (8) - Get more detailed wireless information iw (8) - show / manipulate wireless devices

Example 15Update the apropos Database

sudo mandb
If apropos isn't finding recently installed commands, update the manual page database with mandb. This rebuilds the apropos search index.
Warning: This command requires root privileges. It can take a minute or two to complete on systems with many man pages.
Pro Tip: Run this after installing new software packages to ensure apropos can find the new commands.

📚 Additional Information

Manual Page Sections

Section Description Example
1 User commands ls, cp, mv, cat
2 System calls open, read, write, fork
3 Library functions printf, malloc, strlen
4 Special files (devices) null, zero, tty
5 File formats passwd, hosts, fstab
6 Games fortune, cowsay
7 Miscellaneous ascii, regex, signal
8 System administration mount, useradd, iptables

Common apropos Options

Option Description
-e, --exact Match exact keyword only
-r, --regex Interpret keyword as regular expression
-w, --wildcard Interpret keyword with wildcards (* and ?)
-s, --section Search only specified section(s)
-i, --ignore-case Case-insensitive search
-l, --long Display long output (full descriptions)
-d, --debug Show debugging information

Best Practices

  • Start broad, then narrow: Begin with a general keyword, then use more specific terms or options
  • Use appropriate sections: Know which section to search (-s flag) to get relevant results faster
  • Combine with other commands: Pipe to grep, less, or wc for refined results
  • Keep database updated: Run sudo mandb periodically, especially after installing new software
  • Learn related commands: man, whatis, and info complement apropos

Relationship to Other Commands

apropos keyword   # Search for keyword in man page names/descriptions
man keyword       # Display full manual page for keyword
whatis keyword    # Show one-line description only
info keyword      # Display GNU info documentation
help keyword      # For bash built-in commands

Real-World Use Cases

  • Learning Linux: Discover commands you didn't know existed
  • Troubleshooting: Find diagnostic tools when you know the problem but not the solution
  • Quick Reference: Refresh your memory about command functionality
  • Script Development: Find the right tool for specific tasks in your scripts
  • System Administration: Locate configuration files and admin tools

Common Search Patterns for Sysadmins

# Find all network-related commands
apropos -s 1,8 network

# Find all configuration files
apropos -s 5 conf

# Find all commands containing "file" and "system"
apropos "file system"

# Find all user management commands
apropos -s 8 user | grep add

# Find all monitoring tools
apropos monitor | grep -E "(stat|top|info)"

# Find all security-related commands
apropos security | grep -i "auth\|crypt\|secure"

Troubleshooting

Problem: apropos returns "nothing appropriate"
Solution: Run sudo mandb to rebuild the manual page database
Problem: Recently installed command not showing up
Solution: Update database with sudo mandb, or wait for automatic nightly update
Problem: Too many results
Solution: Use -s to limit to specific sections, or pipe to grep for refinement

Fun Facts

  • apropos is actually just a front-end to the man -k command
  • The word "apropos" means "with regard to" or "concerning" in English
  • The apropos database is typically updated automatically via cron jobs
  • Some systems use a command called makewhatis instead of mandb
  • apropos searches a pre-built index for speed - that's why mandb is needed after installing new software

Advanced Examples

# Find all commands related to archiving or backup
apropos -r '(archive|backup|tar|zip|compress)'

# Find configuration files for network services
apropos -s 5 -r '(network|net|ethernet|wireless)'

# Search for commands in multiple sections (user and admin)
apropos -s 1,8 mount

# Case-insensitive search for SSL/TLS commands
apropos -i ssl

# Find all GNU coreutils commands with "copy"
apropos copy | grep -E "^\w+ \(1\)"

# Discover all *stat commands
apropos -w '*stat'

Creating Your Own Man Pages

If you write custom scripts or programs, you can create man pages for them and they'll be searchable with apropos. Man pages go in /usr/local/man/ and follow the groff format. After adding new man pages, run sudo mandb to index them.

Pro Tip for Students: When learning Linux, make it a habit to run apropos on any keyword related to what you're studying. It's like having a conversation with the system: "Show me everything you know about networking" becomes apropos network.
Pro Tip for Sysadmins: Add apropos searches to your troubleshooting workflow. When facing an unfamiliar problem, apropos can quickly surface tools and utilities you might not know existed.