Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

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?

Update:

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
add comment

2 Answers

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. –  user815423426 Apr 24 '13 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 '13 at 21:59
add comment

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 –  user815423426 Apr 26 '13 at 0:40
add comment

Your Answer

 
discard

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.