5 “apropos” Command Usage Examples in Linux

«
»

This tutorial explains Linux “apropos” command, options and its usage with examples.

apropos – search the whatis database for strings

Description :

advertisement

apropos searches a set of database files containing short descriptions of system commands for keywords and displays the result on the standard output.

Usage :

apropos [-dalhvV] [-e|-w|-r] [-s list] [-m system[,…]] keyword …

Options :

advertisement
advertisement

-d, –debug
Print debugging information.
-v, –verbose
Print verbose warning messages.
-r, –regex
Interpret each keyword as a regular expression. This is the default behavior. Each keyword will be matched against the page names and the descriptions indepenently. It can match any part of either. The match is not limited to word boundaries.
-w, –wildcard
Interpret each keyword as a pattern containing shell-style wildcards. Each keyword will be matched against the page names and the descriptions independently. If –exact is also used, a match will only be found if an expanded keyword matches an entire description or page name. Otherwise the keyword is also allowed to match on word boundaries in the description.
-e, –exact
Each keyword will be exactly matched against the page names and the descriptions.
-a, –and
Only display items that match all the supplied keywords. The default is to display items that match any keyword.
-l, –long
Do not trim output to the terminal width. Normally, output will be truncated to the terminal width to avoid ugly results from poorly-written NAME sections.
-s list, –sections list, –section list
Search only the given manual sections. list is a colon- or comma-separated list of sections. If an entry in list is a simple section, for example “3”, then the displayed list of descriptions will include pages in sections “3”, “3perl”, “3x”, and so on; while if an entry in list has an extension, for example “3perl”, then the list will only include pages in that exact part of the manual section.
-h, –help
Print a help message and exit.
-V, –version
Display version information.

Examples :

1. Single Command Search

$ apropos find
chkdupexe (1)        - find duplicate executables
ffs (3)              - find first bit set in a word
ffsl (3)             - find first bit set in a word
ffsll (3)            - find first bit set in a word
File::MimeInfo::Applications (3pm) - Find programs to open a file by mimetype
find (1)             - search for files in a directory hierarchy
find2perl (1)        - translate find command lines to Perl code
findfs (8)           - find a filesystem by label or UUID
findmnt (8)          - find a filesystem
findsmb (1)          - list info about machines that respond to SMB name quer...
glob (3)             - find pathnames matching a pattern, free memory from gl...
globfree (3)         - find pathnames matching a pattern, free memory from gl...
gst-typefind-1.0 (1) - print Media type of file
gst-typefind-0.10 (1) - print MIME type of file
lfind (3)            - linear search of an array
locate (1)           - find files by name
memdiskfind (1)      - utility to search for a MEMDISK instance
mlocate (1)          - find files by name
oldfind (1)          - search for files in a directory hierarchy
pidof (8)            - find the process ID of a running program.
sane-find-scanner (1) - find SCSI and USB scanners and their device files
tfind (3)            - manage a binary tree
ttyslot (3)          - find the slot of the current user's terminal in some file

2. Multiple Command Search

advertisement
$ apropos find grep
bzegrep (1)          - search possibly bzip2 compressed files for a regular expression
bzfgrep (1)          - search possibly bzip2 compressed files for a regular expression
bzgrep (1)           - search possibly bzip2 compressed files for a regular expression
chkdupexe (1)        - find duplicate executables
egrep (1)            - print lines matching a pattern
ffs (3)              - find first bit set in a word
ffsl (3)             - find first bit set in a word
ffsll (3)            - find first bit set in a word
fgrep (1)            - print lines matching a pattern
File::MimeInfo::Applications (3pm) - Find programs to open a file by mimetype
find (1)             - search for files in a directory hierarchy
find2perl (1)        - translate find command lines to Perl code
findfs (8)           - find a filesystem by label or UUID
findmnt (8)          - find a filesystem
findsmb (1)          - list info about machines that respond to SMB name queries on a subnet
glob (3)             - find pathnames matching a pattern, free memory from glob()
globfree (3)         - find pathnames matching a pattern, free memory from glob()
grep (1)             - print lines matching a pattern
grepdiff (1)         - show files modified by a diff containing a regex
gst-typefind-1.0 (1) - print Media type of file
gst-typefind-0.10 (1) - print MIME type of file
lfind (3)            - linear search of an array
locate (1)           - find files by name
lzegrep (1)          - search compressed files for a regular expression
lzfgrep (1)          - search compressed files for a regular expression
lzgrep (1)           - search compressed files for a regular expression
memdiskfind (1)      - utility to search for a MEMDISK instance
mlocate (1)          - find files by name
msggrep (1)          - pattern matching on message catalog
oldfind (1)          - search for files in a directory hierarchy
pgrep (1)            - look up or signal processes based on name and other attributes
pidof (8)            - find the process ID of a running program.
ptargrep (1)         - Apply pattern matching to the contents of files in a tar archive
rgrep (1)            - print lines matching a pattern
sane-find-scanner (1) - find SCSI and USB scanners and their device files
tfind (3)            - manage a binary tree
ttyslot (3)          - find the slot of the current user's terminal in some file
xzegrep (1)          - search compressed files for a regular expression
xzfgrep (1)          - search compressed files for a regular expression
xzgrep (1)           - search compressed files for a regular expression
zegrep (1)           - search possibly compressed files for a regular expression
zfgrep (1)           - search possibly compressed files for a regular expression
zgrep (1)            - search possibly compressed files for a regular expression
zipgrep (1)          - search files in a ZIP archive for lines matching a pattern

3. Find out all delete / removal related administrative commands:

$ apropos -s8 -w "*delete*"
chkdupexe (1)        - find duplicate executables
ffs (3)              - find first bit set in a word
ffsl (3)             - find first bit set in a word
ffsll (3)            - find first bit set in a word
File::MimeInfo::Applications (3pm) - Find programs to open a file by mimetype
find (1)             - search for files in a directory hierarchy
find2perl (1)        - translate find command lines to Perl code
findfs (8)           - find a filesystem by label or UUID
findmnt (8)          - find a filesystem
findsmb (1)          - list info about machines that respond to SMB name quer...
glob (3)             - find pathnames matching a pattern, free memory from gl...
globfree (3)         - find pathnames matching a pattern, free memory from gl...
gst-typefind-1.0 (1) - print Media type of file
gst-typefind-0.10 (1) - print MIME type of file
lfind (3)            - linear search of an array
locate (1)           - find files by name
memdiskfind (1)      - utility to search for a MEMDISK instance
mlocate (1)          - find files by name
oldfind (1)          - search for files in a directory hierarchy
pidof (8)            - find the process ID of a running program.
sane-find-scanner (1) - find SCSI and USB scanners and their device files
tfind (3)            - manage a binary tree
ttyslot (3)          - find the slot of the current user's terminal in some file
[email protected]:/tmp$ apropos -s8 -w "*delete*"
groupdel (8)         - delete a group
ntfsundelete (8)     - recover a deleted file from an NTFS volume.
userdel (8)          - delete a user account and related files

4. Search using regular expresions

advertisement

Find command that removes file:

$ apropos -r 'remove file'
rm (1)               - remove files or directories

5. Difference between exact and normal search

advertisement
$ apropos -e zip
Archive::Zip (3pm)   - Provide an interface to ZIP archive files.
Archive::Zip::FAQ (3pm) - Answers to a few frequently asked questions about Archive::Zip
Archive::Zip::MemberRead (3pm) - A wrapper that lets you read Zip archive members as if they were files.
Archive::Zip::Tree (3pm) - (DEPRECATED) methods for adding/extracting trees using Archive::Zip
funzip (1)           - filter for extracting from a ZIP archive in a pipe
mzip (1)             - change protection mode and eject disk on Zip/Jaz drive
prezip-bin (1)       - prefix zip delta word list compressor/decompressor
unzip (1)            - list, test and extract compressed files in a ZIP archive
unzipsfx (1)         - self-extracting stub for prepending to ZIP archives
zip (1)              - package and compress (archive) files
zipgrep (1)          - search files in a ZIP archive for lines matching a pattern
zipinfo (1)          - list detailed information about a ZIP archive
 
$ apropos zip
Archive::Zip (3pm)   - Provide an interface to ZIP archive files.
Archive::Zip::FAQ (3pm) - Answers to a few frequently asked questions about Archive::Zip
Archive::Zip::MemberRead (3pm) - A wrapper that lets you read Zip archive members as if they were files.
Archive::Zip::Tree (3pm) - (DEPRECATED) methods for adding/extracting trees using Archive::Zip
bunzip2 (1)          - a block-sorting file compressor, v1.0.6
bzcmp (1)            - compare bzip2 compressed files
bzdiff (1)           - compare bzip2 compressed files
bzegrep (1)          - search possibly bzip2 compressed files for a regular expression
bzfgrep (1)          - search possibly bzip2 compressed files for a regular expression
bzgrep (1)           - search possibly bzip2 compressed files for a regular expression
bzip2 (1)            - a block-sorting file compressor, v1.0.6
bzip2recover (1)     - recovers data from damaged bzip2 files
bzless (1)           - file perusal filter for crt viewing of bzip2 compressed text
bzmore (1)           - file perusal filter for crt viewing of bzip2 compressed text
funzip (1)           - filter for extracting from a ZIP archive in a pipe
gpg-zip (1)          - encrypt or sign files into an archive
gunzip (1)           - compress or expand files
gzip (1)             - compress or expand files
lz (1)               - gunzips and shows a listing of a gzip'd tar'd archive
mzip (1)             - change protection mode and eject disk on Zip/Jaz drive
preunzip (1)         - prefix delta compressor for Aspell
prezip (1)           - prefix delta compressor for Aspell
prezip-bin (1)       - prefix zip delta word list compressor/decompressor
tgz (1)              - makes a gzip'd tar archive
unzip (1)            - list, test and extract compressed files in a ZIP archive
unzipsfx (1)         - self-extracting stub for prepending to ZIP archives
uz (1)               - gunzips and extracts a gzip'd tar'd archive
zforce (1)           - force a '.gz' extension on all gzip files
zip (1)              - package and compress (archive) files
zipcloak (1)         - encrypt entries in a zipfile
zipgrep (1)          - search files in a ZIP archive for lines matching a pattern
zipinfo (1)          - list detailed information about a ZIP archive
zipnote (1)          - write the comments in zipfile to stdout, edit comments and rename files in zipfile
zipsplit (1)         - split a zipfile into smaller zipfiles

Sanfoundry Global Education & Learning Series – 1000 Linux Tutorials.

If you wish to look at all Linux commands and their usage examples, go to Linux Commands Tutorial.

advertisement
advertisement
Subscribe to our Newsletters (Subject-wise). Participate in the Sanfoundry Certification contest to get free Certificate of Merit. Join our social networks below and stay updated with latest contests, videos, internships and jobs!

Youtube | Telegram | LinkedIn | Instagram | Facebook | Twitter | Pinterest
Manish Bhojasia - Founder & CTO at Sanfoundry
Manish Bhojasia, a technology veteran with 20+ years @ Cisco & Wipro, is Founder and CTO at Sanfoundry. He lives in Bangalore, and focuses on development of Linux Kernel, SAN Technologies, Advanced C, Data Structures & Alogrithms. Stay connected with him at LinkedIn.

Subscribe to his free Masterclasses at Youtube & technical discussions at Telegram SanfoundryClasses.