Take the 2-minute tour ×

When programming in C, I like to use man sections 2 and 3 to look up the form of system and library calls.

But I also often need to look up the form of a struct that is defined in a standard library. For example, sockaddr/sockaddr_un in 'sys/socket.h'. Is there any way I can look up structs or header files through man pages?

share|improve this question
add comment

1 Answer

up vote 2 down vote accepted

To find these, it's helpful to use, for example, apropos socket to see which man pages may correspond to the information you desire. In this case, it's man 7 unix:

#define UNIX_PATH_MAX    108
struct sockaddr_un {
    sa_family_t sun_family;               /* AF_UNIX */
    char        sun_path[UNIX_PATH_MAX];  /* pathname */

Is this what you were looking for?

share|improve this answer
Helpful, I did not know about apropos. But this still leaves something to be desired. For example, I would not be able to find the man page for socketaddr_in by apropos socket. (It's under man 7 ip) But there may not be a better solution? –  Stuart Jan 9 '12 at 5:02
No, not unless you want to let your IDE pick those things up for you. –  user8290 Jan 9 '12 at 12:52
add comment

Your Answer


