Sunday, July 12, 2009

Searching man pages with apropos and whatis

I had made an earlier post on reading man pages. In this post we will look at apropos utility with which you can search the man pages of any Linux command for keywords. There is a description section associated with each man page . The apropos command searches the description section for a given keyword. Keywords can be a regular expression or wild-cards , or match the exact keyword.

As an example try

$apropos passwd

chgpasswd (8) - update group passwords in batch mode
chpasswd (8) - update passwords in batch mode
fgetpwent_r (3) - get passwd file entry reentrantly
getpwent_r (3) - get passwd file entry reentrantly
gpasswd (1) - administer the /etc/group and /etc/gshadow files
htpasswd (1) - manipulate HTTP-server password files
htpasswd.apache2-utils (1) - Manage user files for basic authentication
lppasswd (1) - add, change, or delete digest passwords.
mkpasswd (1) - Overfeatured front end to crypt(3)
mksmbpasswd (8) - formats a /etc/passwd entry for a smbpasswd file
pam_localuser (8) - require users to be listed in /etc/passwd
passwd (1) - change user password
passwd (1ssl) - compute password hashes
passwd (5) - the password file
passwd2des (3) - RFS password encryption
smbpasswd (5) - The Samba encrypted password file
smbpasswd (8) - change a user's SMB password
SSL_CTX_set_default_passwd_cb (3ssl) - set passwd callback for encrypted PEM ...
SSL_CTX_set_default_passwd_cb_userdata (3ssl) - set passwd callback for encry...
update-passwd (8) - safely update /etc/passwd, /etc/shadow and /etc/group


All similar man page entries are shown. This can be very useful when you search for a particular command or man page.

Now try
 $ apropos pass*

bluetooth-applet (1) - GNOME applet for prompting the user for a Bluetooth pa...
chage (1) - change user password expiry information
checkPasswdAccess (3) - query the SELinux policy database in the kernel.
chgpasswd (8) - update group passwords in batch mode
chpasswd (8) - update passwords in batch mode
cpgr (8) - copy with locking the given file to the password or gr...
cppw (8) - copy with locking the given file to the password or gr...
crypt (3) - password and data encryption
crypt_r (3) - password and data encryption
des_read_2passwords (3ssl) - Compatibility user interface functions
des_read_password (3ssl) - Compatibility user interface functions
ecryptfs-add-passphrase (1) - add an eCryptfs mount passphrase to the kernel ...
ecryptfs-insert-wrapped-passphrase-in... (1) - unwrap a wrapped passphrase fr...
ecryptfs-rewrap-passphrase (1) - unwrap an eCryptfs wrapped passphrase, rewra...
ecryptfs-unwrap-passphrase (1) - unwrap an eCryptfs mount passphrase from file.
ecryptfs-wrap-passphrase (1) - wrap an eCryptfs mount passphrase.
endpwent (3) - get password file entry
endspent (3) - get shadow password file entry
EVP_BytesToKey (3ssl) - password based encryption routine
expiry (1) - check and enforce password expiration policy
fgetpwent (3) - get password file entry
fgetpwent_r (3) - get passwd file entry reentrantly
fgetspent (3) - get shadow password file entry
fgetspent_r (3) - get shadow password file entry
getpass (3) - get a password
getpw (3) - Re-construct password line entry
getpwent (3) - get password file entry
getpwent_r (3) - get passwd file entry reentrantly
getpwnam (3) - get password file entry


Another utility that can be used for searching man pages is 'whatis'


$ whatis passwd
passwd (1) - change user password
passwd (1ssl) - compute password hashes
passwd (5) - the password file


The relevant man page section is also shown as the second parameter Aon each of the result line. It is also suggested to try the following for getting more ideas /flags on apropos

$ man apropos
$ apropos apropos
$ man whatis
$ whatis aprops
$ apropos whatis

1 comment:

weboblog said...

You can also search Linux man pages with this online tool: http://www.man-online.org/