Background: I'm trying to build my program but first I need to set up libraries in netbeans. My project is using GLU and therefore I installed libglu-dev. I didn't note location where the libraries were located and now I can't find them..

I've switched to Linux just a few days ago and so far I'm very content with it, however I couldn't google this one out and becoming frustrated.. Is there way to find out where files of package were installed without running installation again? I mean if I got library xxx and installed it some time ago, is there somecommand xxx that will print this info?

I've already tried locate, find and whereis commands but either I'm missing something or I just can't do it correctly.. for libglu, locate returns:


Other two commands fail to find anything. Now locate did it's job but I'm sure none of those paths is where the library actually resides (at least everything I was linking so far was in /usr/lib or usr/local/lib).

The libglu was introduced just as example, I'm looking for general solution for this problem.


Easy! dpkg -L packagename. That will list all files (with location) that were brought in by the package.

  • 1
    Wow, exactly what I was looking for, thanks! Just a quick note: the one I was looking for is /usr/lib/i386-linux-gnu/libGLU.so.1 (obtained with dpkg) and the actual name of library for the command is libglu1-mesa. – Raven Mar 23 '12 at 21:50
  • 3
    Great. I'll also recommend apt-file. It needs to be installed and then you need to do apt-file update. apt-file list does the same as dpkg -L, but without the need to install the package first. apt-file search enables you to find out which package provides a certain file. Cool tools :) – Jo-Erlend Schinstad Mar 23 '12 at 21:56

In case if you are not sure about package name you could list all packages and try to find requested:

 dpkg --get-selections | grep -v deinstall | grep <packagename>

 For example:
      $dpkg --get-selections | grep -v deinstall | grep zip
      bzip2                      install
  And then:
      $ dpkg -L zip

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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