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?

2 Answers 2


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.

  • 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. Apr 24, 2013 at 18:19
  • 1
    @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, 2013 at 21:59

whereis works for in path executables and libraries.

> whereis libc
libc: /lib64/libc.so /usr/lib64/libc.so
  • 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 Apr 26, 2013 at 0:40

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .