Lone Learner Lone Learner - 2 months ago 8
C Question

How to find man pages for C structs?

I am having a hard time finding man pages for the structures used in socket. So I am currently learning about them from a separate online tutorial. But it would be nice to know how to lookup these structures in the man pages itself.

I am using a Debian 8.3 Linux system.

For example, I found information about

struct addrinfo
in
man getaddrinfo
.

But I have not been able to find information about
struct sockaddr_in
in any man page. Which man page contains the details about this struct? And how to find out the man pages for such structures in general?

Answer

You can find that specific structure by typing man 7 ip and then searching manually for it or pressing / and typing sockaddr_in.

If you don't know what section to look in you can try using a quick search with man -k sockaddr_in. If that doesn't give you the result you are looking for try brute-forcing it with man -K sockaddr_in, this might be very slow because it will scan all the man files on your system.

@Jean-FrançoisFabre his comment about using a search engine is probably the fastest way to find the information you want though.