Preliminary
Suppose you want to find a command that relates to foobie bletch, but you have no idea what that command might be. The manual (`man') pages can be searched in two ways: search one line description; and search complete page.
Search one line description
Each man page has a brief, one line description. For example, the brief description for the man manual page is `man - format and display the on-line manual pages'. You can search the brief description for all pages using the command man -k. Include one (or more) keywords that would appear in the description, and all matching pages are found. For example, if you want to find all commands that might let you search for a pattern, type man -k pattern. You will get the following output like this:
awk(1) - GNU awk pattern scanning and processing language
grep(1), egrep(1), fgrep(1) - print lines matching a pattern
lptest(1) - generate lineprinter ripple pattern
zipgrep(1) - search files in a ZIP archive for lines matching a pattern
Searching the complete man page
It might be the keywords that you wish to read about do not appear in any of the brief descriptions. You can still find an appropriate man page. You can search complete man pages using the grep command.
The man pages are stored in just a few groups of directories. Most are stored in directories within /usr/man. Your machine could have other places, in addition to this, for example many sites also have man pages in /usr/X11R6/man and /usr/local/man.
Suppose you want to find out about zombie processes. man -k is not helpful, so try:
$ grep -l -i zombie /usr/man/*/*
This produces:
/usr/man/man1/perlfunc.1
/usr/man/man1/perlipc.1
/usr/man/man1/ps.1
/usr/man/man1/screen.1
/usr/man/man1/top.1
/usr/man/man2/kill.2
/usr/man/man2/wait.2
/usr/man/man2/wait4.2
/usr/man/man5/proc.5
/usr/man/man8/fsck.minix.8
You will quickly discover that perlfunc, perlipc, ps, screen and top are unhelpful. You will equally quickly discover that kill, wait and wait4 all are useful.
No comments:
Post a Comment