Home > Articles

  • Print
  • + Share This
This chapter is from the book

This chapter is from the book

Find a Command Based on What It Does

apropos

The whatis command is similar to man -f, and the apropos command is likewise similar to man -k. Both commands search man pages for the names and descriptions of commands, helping you if you know what a command does but can't remember its name.

Using apropos is easy: Just follow the command with a word or phrase describing the feature of the command in which you're interested.

$ man list
No manual entry for list
$ man -k list
last (1) - show listing of last logged in users
ls (1) - list directory contents
lshw (1) - list hardware
lsof (8) - list open files
[Listing condensed due to length]
$ apropos list
last (1) - show listing of last logged in users
ls (1) - list directory contents
lshw (1) - list hardware
lsof (8) - list open files
[Listing condensed due to length]

Just like whatis, you can use the -w (or --wildcard) or the -r (or --regex) options for searches. More interestingly, though, you can use the -e option (or --exact) when you want to tightly focus on a word or phrase, without any exception. For instance, in the previous listing, searching for list turned up the last command because it had the word listing in its description. Let's try that same search, but with the -e option.

$ apropos -e list
ls (1) - list directory contents
lshw (1) - list hardware
lsof (8) - list open files
[Listing condensed due to length]

This time, last doesn't show up because you wanted only results with the exact word list, not listing. In fact, the list of results for list went from 80 results without the -e option to 55 results with the -e option, which makes it far easier to precisely target your command searches and find exactly the command you want.

  • + Share This
  • 🔖 Save To Your Account