How to Use the Apropos Command in Linux

How to Use the Apropos Command in Linux

·

4 min read

The apropos command in Linux is an incredibly useful tool for finding information about programs and other tools available on the Linux system.

It searches through man (manual) page names and descriptions, allowing users to quickly locate the helpful information they need.

By using the apropos command, Linux users can save time and energy when trying to figure out how to use a command or program.

In this blog post, we will discuss what the apropos command is, how it works, and how you can use it to get the information you need in Linux.

# What is the Apropos Command?

apropos is an essential command in the Linux operating system. It is used to search for commands and other relevant information within the Linux manual pages.

With apropos, you can easily search through all of the man pages and find exactly what you are looking for. This can be especially helpful when you’re not sure of the exact command or program you need out of the many available commands present in the Linux OS.

apropos is a very simple command to use. All it requires is a keyword or phrase, and it will return a list of commands that are related to that keyword or phrase.

You can also specify different flags, which we will look into later, to refine your search and help narrow down the results.

The apropos command is included with the majority of Linux distributions, so you don’t have to install any additional software. It is incredibly useful for beginners and experienced users alike.

# How to Use the Apropos Command

To use the apropos command on a basic level is easy, you just have to pass the seed word you’re looking for as input to this command. An example would be:

$ apropos compress

As you may have guessed with our above seed keyword, we’re trying to look for commands to compress a file. This will return all possible Linux commands that can be used when trying to compress a file or work with file compression.

Output:

Output:

bzexe (1)            - compress executable files in place
cjpeg (1)            - compress an image file to a JPEG file
compress (1)         - compress and expand data
gunzip (1)           - compress or expand files
gzexe (1)            - compress executable files in place
gzip (1)             - compress or expand files
hwloc-compress-dir (1) - Compress a directory of XML topologies
lzcat (1)            - Compress or decompress .xz and .lzma files
lzma (1)             - Compress or decompress .xz and .lzma files
uncompress (1)       - compress or expand files
uncompress.real (1)  - compress and expand data
unlzma (1)           - Compress or decompress .xz and .lzma files
unxz (1)             - Compress or decompress .xz and .lzma files
unzstd (1)           - zstd, zstdmt, unzstd, zstdcat - Compress or decompress...
upx (1)              - compress or expand executable files
upx-ucl (1)          - compress or expand executable files
xz (1)               - Compress or decompress .xz and .lzma files
xzcat (1)            - Compress or decompress .xz and .lzma files
zcat (1)             - compress or expand files
zip (1)              - package and compress (archive) files
zstd (1)             - zstd, zstdmt, unzstd, zstdcat - Compress or decompress...
zstdcat (1)          - zstd, zstdmt, unzstd, zstdcat - Compress or decompress...
zstdmt (1)           - zstd, zstdmt, unzstd, zstdcat - Compress or decompress...

This has returned a lot of commands to work with file compression, and you can just make more research on a specific command of your choice.

# Linux apropos Command Options

This command can be used with various optional flags to change the behavior of the command. The following list shows all the available options that can be used with the apropos command:

- eReturn names and descriptions that match the exact keywords.
- dPrints debugging messages.
- wSearches for the keyword with wildcards.
- aFunctions as logical AND. Returns output when all the keywords match.
- lStops output trimming.
- CUses user-configuration files instead of the $MANPATH.
- sSearches only in specific man pages sections.
- MSets the search path to PATH rather than the default $MANPATH.
- mLooks for man page descriptions from other OSs.
- LSets the locale for the search.
- rInterprets each keyword as a regex.

# Conclusion

The apropos command is a great way to save time when navigating through tons of Linux commands available out of the box, exploring alternative commands, and more.

With just a few keystrokes, you can easily search for the exact command you need. Try it out today and make your life easier.