Read Descriptions of Commands


whatis

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 


Tip

There's not enough room in this book to cover regular expressions, but you can read more in Sams Teach Yourself Regular Expressions in 10 Minutes (ISBN: 0672325667) by Ben Forta.


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.



Linux Phrasebook
Linux Phrasebook
ISBN: 0672328380
EAN: 2147483647
Year: 2007
Pages: 288

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net