Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

With binaries, I can always do which foo to know which binary I am invoking with $ foo, but what about man pages? Is there a way to know the path of the man page will be loaded by default?

Similarly, what about dynamic libraries? Is there any to find out the path of the .so file that will be loaded for a given library name?


I just learned about pkg-config, but I didn't see an option to ask it to output paths. Also, it looks like it requires having .pc files that specify paths. Still is this something that could help with this problem?

share|improve this question

man -w will print the path to manpage.

ldd may do the trick for libraries, run it on the executable that's linked against them.

share|improve this answer
Thanks. man -w works great. As for libraries, what I am looking for is a way to retrieve the path of a library from it's name. – Amelio Vazquez-Reina Apr 24 '13 at 18:19
@user815423426 try pkg-config --libs foo for the location, pkg-config --list-all for a list of the packages it knows about. – Kevin Apr 24 '13 at 21:59

whereis works for in path executables and libraries.

> whereis libc
libc: /lib64/libc.so /usr/lib64/libc.so
share|improve this answer
This looks great, thanks. Do you know if, when asking about a library, whereis checks the value of LD_LIBRARY_PATH? The reason why I ask is because whereis keeps returning paths to the system dynamic libraries even though they come after the ones I have at the beginning of LD_LIBRARY_PATH – Amelio Vazquez-Reina Apr 26 '13 at 0:40

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.