=================================================== Searching for items in the Unix manual pages (RTFM) =================================================== -Ian! D. Allen - idallen@idallen.ca On the DOS command line, commands print internal help by using the "/?" command line switch. Under Unix, you can try giving an argument of "--help" or "-help", or "-h". Not all commands have internal help. Manual pages: Unix help files are called "man pages" Access man pages via the "man" command, e.g. "man man", "man date", etc. Useful Unix start page: "man intro" (Unix command introduction) Some man pages are summaries of the GNU "TexInfo" pages that are available via the "info" or "pinfo" commands. (Use "pinfo" if you must; this documentation format pre-dates the WWW and is awkward to navigate.) The Unix manual has "sections". The man command searches sections in a particular order and finds the first matching man page (which may not be in the section you want). Specify the section number first to see a page in a particular section, e.g. man 5 passwd Useful sections (for details, try "man 1 intro", "man 2 intro", etc.): Section 1 - user commands e.g. date,who Section 8 - super-user and admin commands e.g. useradd,ifconfig Section 2 - kernel system calls e.g. read(),write() Section 3 - library function calls e.g. fread(),fwrite() Section 4 - special files e.g. null,fifo,zero,hd Section 5 - file formats e.g. passwd,group,resolv.conf $ man passwd # gives passwd command from section 1 $ man 5 passwd # gives /etc/passwd file format from section 5 Finding a keyword (e.g. 'name') in the title lines of manual pages: $ man -k name | less The "|" character is the Unix "pipe" special character. Finding only pages in section (1) of the manual: $ man -k name | grep '(1)' | less Note the use of single quotes to protect the special characters (in this case, parentheses) from the Unix shell. Until you know what characters are safe, always single-quote the first argument to the grep command. Finding only pages that are *not* in section (1) of the manual: $ man -k name | grep -v '(1)' | less Note the use of the "-v" option to the "grep" command (RTFM). Finding pages containing "name" in the title, that are in section (1), that do not contain the string "directory" in the title: $ man -k name | grep '(1)' | grep -v directory | less "man -k" works the same way as the "apropos" command: $ apropos name | grep '(1)' | grep -v directory | less If "less" is not available, use "more" in place of "less" to paginate large output. Make sure you protect the characters used in the grep pattern (the first argument to grep) from expansion or processing by the shell.