Command documentation sourced from the linux-command project This comprehensive command reference is part of the linux-command documentation project.
apropos - Search the Manual Page Names and Descriptions
The apropos command is a powerful utility that searches the manual page database for commands and programs based on keywords and descriptions. It enables users to quickly find relevant commands when they know what they want to do but don't know the specific command name. The command uses the whatis database generated by mandb to provide fast keyword searches across all available manual pages, making it an essential tool for both beginners learning Linux and experienced administrators looking for utilities.
Basic Syntax
apropos [-dalhvV] [-e|-w|-r] [-s section] [-m system[,...]] [-M path] [-L locale] [-C file] keyword ...
Common Options
Search Patterns
-e, --exact- Search for exact keywords only-r, --regex- Interpret each keyword as a regular expression-w, --wildcard- The keyword(s) contain wildcards-a, --and- Only display items that match all keywords
Output Control
-l, --long- Do not trim output to terminal width-d, --debug- Print debugging information-v, --verbose- Print verbose warning messages
Manual Section Filtering
-s section, --section section- Search only specific manual sections1- User commands2- System calls3- Library functions4- Devices and special files5- File formats and conventions6- Games7- Miscellaneous8- System administration commands9- Kernel routines
Database and Locale
-m system[,...], --manpath=system[,...]- Set search paths for manual pages-M path, --global-manpath=path- Use global manpath-L locale, --locale=locale- Define the locale for this search-C file, --config-file=file- Use alternate configuration file
Information
-h, --help- Display help information-V, --version- Show version information
Usage Examples
Basic Keyword Searching
Simple Command Discovery
# Search for text editing commands
apropos editor
apropos "text editor"
# Search for file compression tools
apropos compress
apropos archive
# Search for network utilities
apropos network
apropos "network connection"
# Search for system monitoring tools
apropos monitor
apropos "system information"
Specific Task Searches
# Find commands for password management
apropos password
# Find commands for process management
apropos process
apropos "process kill"
# Find commands for disk usage
apropos "disk usage"
apropos "file system"
# Find commands for user management
apropos "user management"
apropos "add user"
Advanced Pattern Matching
Regular Expression Searches
# Use regular expressions for flexible matching
apropos -r "^git.*"
apropos -r ".*network.*"
# Search for commands starting with specific letters
apropos -r "^ls"
apropos -r ".*stat$"
# Complex pattern searches
apropos -r "(copy|cp|duplicate)"
# Search for commands with specific patterns
apropos -r "audio|sound|media"
Wildcard Searches
# Use wildcards for partial matching
apropos -w "net*"
apropos -w "*compress*"
# Search for commands with specific endings
apropos -w "*admin"
apropos -w "*config*"
# Mixed wildcard searches
apropos -w "file*"
apropos -w "sys*"
Exact Matching
# Search for exact phrases only
apropos -e "file system"
apropos -e "domain name"
# Find commands with specific descriptions
apropos -e "list directory"
apropos -e "copy files"
# Combine with other options
apropos -e -s 1 "user command"
Section-Specific Searches
Search in Specific Manual Sections
# Search only user commands (section 1)
apropos -s 1 editor
# Search only system calls (section 2)
apropos -s 2 "file"
# Search only library functions (section 3)
apropos -s 3 "memory"
# Search only system administration (section 8)
apropos -s 8 "network"
# Search multiple sections
apropos -s 1,8 "backup"
apropos -s 2,3,4 "device"
Filter by Manual Type
# Find user commands only
apropos -s 1 -a copy file
# Find administrative tools
apropos -s 8 -a system service
# Find programming functions
apropos -s 2,3 -a string manipulation
# Find file format documentation
apropos -s 5 -a configuration
Combined Keyword Searches
AND Logic Operations
# Find commands matching multiple criteria
apropos -a "file" "copy"
# Search for network backup tools
apropos -a network backup
# Find system monitoring commands
apropos -a system monitor process
# Search for text processing tools
apropos -a text process filter
# Complex combined searches
apropos -a "user" "add" "system"
Multi-keyword Searches
# Search with multiple related terms
apropos compress archive backup
# Find development tools
apropos compiler debugger development
# Search for security tools
apropos security authentication encryption
# Find multimedia commands
apropos video audio media player
Practical Examples
System Administration
Command Discovery for Admins
# Find system service management tools
apropos -s 8 service
apropos -s 8 daemon
apropos -s 8 "system control"
# Find user management commands
apropos -s 1,8 user group
apropos -s 8 "add user"
apropos "change password"
# Find disk and filesystem tools
apropos -s 8 filesystem
apropos -s 1,8 "disk usage"
apropos "mount filesystem"
# Find network administration tools
apropos -s 8 network
apropos -s 8 firewall
apropos -s 8 "network interface"
Troubleshooting Command Discovery
# Find debugging and diagnostic tools
apropos debug diagnostic
apropos -s 1,8 log monitor
apropos "system status"
# Find performance monitoring commands
apropos performance memory cpu
apropos -s 8 "system performance"
# Find network troubleshooting tools
apropos network troubleshoot ping
apropos "network connection"
Development Workflow
Programming Tool Discovery
# Find development tools
apropos compiler debugger
apropos "version control"
apropos "build system"
# Find programming utilities
apropos -s 1 make gcc
apropos -s 3 library function
# Find text processing tools for development
apropos -s 1 text edit search
apropos -s 1 "regular expression"
# Find documentation tools
apropos -s 1 manual documentation
apropos -s 7 "programming tools"
Scripting and Automation
# Find scripting tools
apropos shell script
apropos -s 1 bash shell
# Find automation utilities
apropos -s 1 automation schedule
apropos -s 8 "system automation"
# Find file processing tools
apropos -s 1 file process parse
apropos -s 1 "text manipulation"
Learning and Exploration
Learning Linux Commands
# Discover basic Linux commands
apropos -s 1 "list files"
apropos -s 1 "copy files"
apropos -s 1 "remove files"
# Find help and information commands
apropos -s 1 help manual
apropos -s 1 information about
# Explore system information commands
apropos -s 1 "system information"
apropos -s 1 hardware memory
# Discover networking basics
apropos -s 1 "network connection"
apropos -s 1 download upload
Command Category Exploration
# Explore all file commands
apropos -s 1 file | head -20
# Explore network tools
apropos -s 1 network | head -20
# Explore system tools
apropos -s 1 system | head -20
# Find all text-related commands
apropos -s 1 text | head -20
Advanced Usage
Database Management
Manual Database Operations
# Update manual database (run as root)
sudo mandb
# Check manual database status
apropos -d test # Debug mode shows database info
# Force database rebuild
sudo mandb -c
# Check for missing whatis entries
sudo mandb -p
Custom Manpath Configuration
# Search in custom manual directories
apropos -M /custom/man/path searchterm
# Use multiple man paths
apropos -M /usr/share/man:/custom/man searchterm
# Specify system-specific manual paths
apropos -m local,custom searchterm
Internationalization
Locale-Specific Searches
# Search in specific locale
apropos -L fr_FR editor
apropos -L de_DE komprimieren
# Display all available locales
locale -a
# Force English search
apropos -L C editor
# Search with locale fallback
apropos -L en_US.UTF-8 editor
Output Formatting
Custom Output Display
# Prevent line truncation
apropos -l "long search term"
# Show verbose warnings
apropos -v searchterm
# Debug mode for troubleshooting
apropos -d -v searchterm
# Combine multiple output options
apropos -l -v -a keyword1 keyword2
Integration and Automation
Shell Scripts
Command Discovery Script
#!/bin/bash
# Interactive command finder using apropos
search_category() {
local category="$1"
local section="$2"
echo "=== $category ==="
if [ -n "$section" ]; then
apropos -s "$section" "$category" | head -10
else
apropos "$category" | head -10
fi
echo ""
}
# Interactive command discovery
echo "Linux Command Discovery Tool"
echo "============================"
echo ""
# Common categories
search_category "file management" "1"
search_category "network tools" "1"
search_category "system monitoring" "1"
search_category "text editing" "1"
# User input for custom search
read -p "Enter search term: " search_term
if [ -n "$search_term" ]; then
apropos "$search_term"
fi
Command Learning Assistant
#!/bin/bash
# Learn Linux commands by category
learn_commands() {
local topic="$1"
echo "Learning about: $topic"
echo "====================="
# Get commands and descriptions
apropos "$topic" | while IFS= read -r line; do
command_name=$(echo "$line" | awk '{print $1}')
description=$(echo "$line" | cut -d'-' -f2-)
echo "Command: $command_name"
echo "Description: $description"
echo "Manual: man $command_name"
echo "---"
done
}
# Example usage
learn_commands "file compression"
learn_commands "network monitoring"
System Documentation Index
#!/bin/bash
# Create indexed documentation of available commands
create_command_index() {
local output_file="command_index.txt"
echo "# Linux Command Index" > "$output_file"
echo "Generated on: $(date)" >> "$output_file"
echo "" >> "$output_file"
# Index by section
for section in 1 2 3 4 5 6 7 8; do
echo "## Section $section" >> "$output_file"
apropos -s "$section" . | sort >> "$output_file"
echo "" >> "$output_file"
done
echo "Command index created: $output_file"
}
create_command_index
Integration with Other Tools
Enhanced Command Discovery
# Combine apropos with which to find available commands
for cmd in $(apropos -s 1 editor | awk '{print $1}' | head -5); do
if which "$cmd" >/dev/null 2>&1; then
echo "Found: $cmd at $(which "$cmd")"
echo "Description: $(apropos "$cmd" | head -1)"
fi
done
# Combine with man to show brief help
show_command_help() {
local search="$1"
apropos "$search" | while IFS= read -r line; do
cmd=$(echo "$line" | awk '{print $1}')
echo "--- $cmd ---"
whatis "$cmd" 2>/dev/null || echo "No whatis entry"
echo ""
done
}
Command Categorization
# Categorize commands by function
categorize_commands() {
echo "File Operations:"
apropos -s 1 "file" | grep -E "(copy|move|remove|list)" | head -5
echo "Network Tools:"
apropos -s 1 "network" | head -5
echo "System Info:"
apropos -s 1 "system" | head -5
}
categorize_commands
Troubleshooting
Common Issues
No Results Found
# Check if manual database exists
ls -la /var/cache/man/whatis
# Rebuild manual database
sudo mandb
# Check manual page directories
manpath
# Try broader search terms
apropos "partial term"
# Check if apropos is installed
which apropos
Database Corruption
# Symptoms: apropos returns no results or error messages
apropos test # Test with simple term
# Rebuild database completely
sudo mandb -c
# Check permissions
ls -la /var/cache/man/
# Fix permissions if needed
sudo chown -R man:man /var/cache/man/
Locale Issues
# Check current locale
locale
# Force English locale
LC_ALL=C apropos searchterm
# Set locale explicitly
LANG=en_US.UTF-8 apropos searchterm
# Check manual database locale settings
man --path
Performance Issues
# Apropos is slow - check database size
du -sh /var/cache/man/
# Rebuild optimized database
sudo mandb -c -q
# Use specific sections to limit search
apropos -s 1 searchterm
# Limit search scope with exact match
apropos -e "specific term"
Debugging Techniques
Verbose Output
# Show debugging information
apropos -d -v searchterm
# Check what database files are used
apropos -d searchterm 2>&1 | grep whatis
# Trace manual path resolution
manpath -d
Database Inspection
# Check whatis database contents
strings /var/cache/man/whatis | head
# Test specific keywords
echo "test" | mandb -u
# Verify database integrity
sudo mandb -t
Related Commands
man- Display manual pageswhatis- Display one-line manual page descriptionswhereis- Locate binary, source, and manual page fileswhich- Locate a command in the PATHmandb- Manual page database managementmanpath- Determine search path for manual pagesinfo- Read Info documentshelp- Display help information for shell built-ins
Best Practices
- Use specific keywords for better search results
- Combine apropos with which to verify command availability
- Regularly update manual database with
sudo mandb - Use section filtering to narrow down search scope
- Try variations of search terms if initial search fails
- Use exact matching (-e) for precise results
- Check manual pages after finding commands with apropos
- Use wildcards (-w) for flexible pattern matching
- Combine multiple keywords with AND logic (-a)
- Verify locale settings for internationalized searches
Performance Tips
- Use specific sections (-s) to limit search scope
- Exact matching (-e) is faster than pattern matching
- Regular expressions (-r) are powerful but slower
- Keep manual database updated for optimal performance
- Use narrower search terms to reduce processing time
- Limit output with head or tail when dealing with many results
- Avoid very broad terms like "file" or "system"
- Use wildcards sparingly as they increase processing time
- Consider using whatis for single-command lookups
- Cache frequent searches in scripts or aliases
The apropos command is an indispensable tool for discovering and learning Linux commands. By providing fast keyword-based access to the entire manual page database, it enables users to quickly find the right tool for any task, making it essential for both system administration and day-to-day Linux usage.