View Full Version : man -k (how to use correctly)

01-14-2009, 10:55 AM
hi all, I know this isn't programming directly but will help indirectly to a program I am writing.
I'm not sure if I am using the manual pages correctly from the terminal. From notes from a lecture the professor has said that a 'man -k uid' - will bring up info such as this:

struct passwd *getpwnam(const char *name);
struct passwd *getpwuid(uid_t uid);
int getpwnam_r(const char *name, struct passwd *pwbuf,
char *buf, size_t buflen, struct passwd **pwbufp);
int getpwuid_r(uid_t uid, struct passwd *pwbuf,
char *buf, size_t buflen, struct passwd **pwbufp);

The lecturer says that you can then exit the screen by pressing 'Q' for quit.
However, when ever i do it all i get is:

cwaves (6x) - languid sinusoidal colors
dbus-uuidgen (1) - Utility to generate UUIDs
fdutilsconfig (8) - configure the suid bit of fdmount
findfs (8) - Find a filesystem by label or UUID
Gnome2::Druid (3pm) - (unknown subject)
Gnome2::DruidPage (3pm) - (unknown subject)
Gnome2::DruidPageEdge (3pm) - (unknown subject)
Gnome2::DruidPageStandard (3pm) - (unknown subject)
Gnome2::UIDefs (3pm) - (unknown subject)
LDP (7) - Intro to the Linux Documentation Project, with help, guides and documents
mdoc (7) - quick reference guide for the -mdoc macro package
pam_loginuid (8) - Record user's login uid to the process attribute
uuidd (8) - UUID generation daemon
uuidgen (1) - command-line utility to create a new UUID value
vol_id (8) - probe filesystem type and read label and uuid

Why isn't the synopsis and explanation of uid displayed? Or am I doing this completely wrong?

01-14-2009, 11:00 AM
Because man -k means search for the keyword and list all the relevant topics, about the same as the "apropos" command.

-k direct man to search the whatis databases for any entry matching the
given keyword. This is useful when the precise topic is unknown; it
reports the topics that have to do with the given keywords, according
to their whatis descriptions. Output will be sent to the user's
PAGER. This switch is automatically enabled if man is invoked as apro-


01-14-2009, 11:00 AM
So -k gives you all the man pages that reference uid. You can then read those man pages (with just plain man) to see what they have to say. man -K (notice the difference) searches inside the man pages (and at least in my version of Mac OS here, it asks me, for each one it finds, whether I want to read it).

You can get information about man by typing "man --help".