Home > Articles

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

This chapter is from the book

Read Descriptions of Commands


Earlier in this chapter you found out about the -f option for man, which prints onscreen the description of a command found in a man page. If you can remember that man -f presents that information, bully for you. It might be easier, however, to remember the whatis command, which does exactly the same thing: Displays the man page description for a command.

$ man -f ls
ls (1) - list directory contents
$ whatis ls
ls (1) - list directory contents

The whatis command also supports regular expressions and wildcards. To search the man database using wildcards, use the -w option (or --wildcard).

$ whatis -w ls*
ls (1) - list directory contents
lsb (8) - Linux Standard Base support for Debian
lshal (1) - List devices and their properties
lshw (1) - list hardware
lskat (6) - Lieutnant Skat card game for KDE
[Listing condensed due to length]

Using wildcards might result in a slightly slower search than whatis without options, but it's pretty negligible on today's fast machines, so you probably don't have to worry about it.

Regular expressions can be used with the -r (or --regex) option.

$ whatis -r ^rm.*
rm (1) - remove files or directories
rmail (8) - handle remote mail received via uucp
rmdir (1) - remove empty directories
rmt (8) - remote magtape protocol module

Again, regular expressions are supposed to slow down the response you get with whatis, but you'll probably never notice it.

The whatis command is easy to remember (easier than man -f, some would say) and it quickly returns some important information, so memorize it.

  • + Share This
  • 🔖 Save To Your Account