100

For some applications its fairly easy enough to locate where the application was installed to using the "which" command. However, some applications such as Tomcat are a little out of my league to locate.

I'm asking for particular methodology that can be applied to any apt-get install to locate where the binary, library, and support files are installed to.

The cause of this question is that I installed Tomcat7 and I can's seem to locate it and I have a list of customizations to perform.

2
  • 1
    Note that I found where tomcat7 is installed soon afterwards by installing apache2 and then visiting the default page @ localhost:8080 but there is more than that which is shown on that page. Searching the filesystem via the "search:" option in the folder browser found plenty more.
    – Sn3akyP3t3
    May 1, 2012 at 1:33
  • Also informative: How to find application's path from command line?
    – Slothworks
    Aug 14, 2015 at 6:40

4 Answers 4

132

You can run the command dpkg -L package to list all the files in the package. For example dpkg -L ubuntu-minimal will only list a couple of small files related to packaging, as it is only an empty meta-package that depends on other packages.

dpkg -L tomcat7

is probably what you want.

4
  • That's exactly what I was looking for! I'll have to read up on man dpkg since I've been neglecting to do so as it seems.
    – Sn3akyP3t3
    May 1, 2012 at 3:22
  • This is a lifesaver for an unfamiliar java library! I didn't even know the name of the file to look for with locate... Now I can update my classpath.
    – sage
    Mar 9, 2015 at 2:17
  • hello pal , do you know the alternative in fedora 29 Dec 27, 2018 at 18:07
  • Only works if it is installed already? Correct? Because it does not work for me.
    – s1mmel
    Oct 13, 2020 at 6:52
27

You can list the contents of an installed package with the dpkg command, which is the low-level package manipulation command that the APT tools call internally:

dpkg -L tomcat7

You may want to search in the output; use the grep command. For example, to see the configuration files (which live under /etc):

dpkg -L tomcat7 | grep /etc

The files you want to modify may be in dependencies of the main tomcat7 package. Searching inside a package and its dependencies is more complicated. It's likely that the files you're looking for are in some package called tomcat7-something. The easiest way to display them is with the apt-file command, which is not installed by default (install it with apt-get install apt-file).

apt-file list tomcat7

apt-file lists file names in all packages in Ubuntu (according to the package sources you have enabled), whether they are installed or not. You can also use it to search for a file:

$ apt-file search RequestInfoExample.java
tomcat7-examples: /usr/share/tomcat7-examples/examples/WEB-INF/classes/RequestInfoExample.java
1
  • I'll have to try apt-file sometime before installing stuff. Thanks!
    – Sn3akyP3t3
    May 1, 2012 at 3:27
6

What I usually do is:

  • Start Synaptic (you will need to install it first)

  • find the package I'm interested in

  • right click, select Properties

  • view the list of installed files

0

I see many responses rightly saying "dpkg -L " is the command for listing content of an installed package. But, none of them have answered the other question, why does "which" command list empty for some of the packages? The answer is; "which" displays the location of an executable alone, not all the content of the package. In case, a package does not contains any executable, then "which" display empty. For example, openssl package provides an executable with the same name for various cryptographic operations. Whereas, libssl-dev package contains development lib, not any executable.

You must log in to answer this question.

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