video

Linux tip: How to use the apropos command

In today’s Linux tip, we look at the apropos command – a command that helps you locate and identify commands even when you can’t remember their names.

Similar
Comments
Hi, this is Sandra Henry-Stocker, author of the “Unix as a Second Language” blog on NetworkWorld.
In today’s Linux tip, we’re going to look at the apropos command – a command that helps you to locate and identify commands even when you can’t remember their names. The command uses information from the man pages to identify commands related to the term that you provide as an argument.
Say you are looking to compare compressed files, but you’re not sure what commands are available to you. You can use the “apropos compare” command to get a list of the commands on your system and a brief description of each one of them.
$ apropos compare
Admittedly, that’s a lot of options. Maybe you’ll spot a command in the list that you’ve used before or follow up by looking at some of the man pages to learn more.
Some useful options for the apropos command are -l, -e and -s. The -l (long) option keeps the command from truncating the command descriptions to fit on a single line. They wrap around instead.
$ apropos -l account
The -e (exact) option tells apropos that you only want to see exact matches (e.g., compress but not compressed).
$ apropos -e compress
The -s (section) option selects information from only one section of the man pages. Remember that there are 8 altogether:
1 = general
2 = system calls
3 = library functions
4 = special files (e.g., devices)
5 = file formats and conventions
6 = miscellaneous
7 = sysadmin commands and daemons
If you only want to look in the 7th (sysadmin commands) section, you might use a command like this:
$ apropos -s 7 arp
arp (7) - Linux ARP kernel module.
The apropos command can introduce you to commands you might not realize are available to you and can even help when you can only remember part of a command’s name.
$ apropos apro
That’s your 2-minute Linux tip for today. If you liked this video, please hit the like and share buttons. For more Linux tips, be sure to follow us on Facebook, YouTube and NetworkWorld.com.