How to find the Path of an Installed Program in Ubuntu

Back in my FreeBSD days I relied heavily on the locate command to find out where things were installed. Since switching to Debian based Linux I’ve found that command to be far less reliable. The reason for this is it relies on a database that is almost always out of date. Now this is also true for FreeBSD however I never had any issues locating files with it, which makes me wonder if they automatically called it after installing apps through ports or if it ran periodically via a cron job. So you may ask yourself, why am I not recommending this approach? The first is that it’s slow, it takes time to update this database so running updatedb before each locate command will eat up a good 30 seconds or more (you could schedule it with cron though). The second is that it is a security risk which exposes file locations to any non root user. Well then, what do I recommend instead?

dpkg -L program

This will work with any program installed with apt-get, synaptic or dpkg. It is almost much faster and secure — it will only expose installed programs and not personal files. So let’s see an example of it’s output:

fettesps@athlon3200 ~ $ dpkg -L eggdrop
/.
/usr
/usr/share
/usr/share/doc
/usr/share/doc/eggdrop
/usr/share/doc/eggdrop/NEWS.gz
/usr/share/doc/eggdrop/README.Debian
/usr/share/doc/eggdrop/copyright
/usr/share/doc/eggdrop/README.gz
/usr/share/doc/eggdrop/changelog.Debian.gz
/usr/bin
/usr/bin/eggdrop
/usr/lib
/usr/lib/eggdrop
/usr/lib/eggdrop/modules
/usr/lib/eggdrop/modules/assoc.so
/usr/lib/eggdrop/modules/blowfish.so
/usr/lib/eggdrop/modules/channels.so
/usr/lib/eggdrop/modules/compress.so
/usr/lib/eggdrop/modules/console.so
/usr/lib/eggdrop/modules/ctcp.so
/usr/lib/eggdrop/modules/dns.so
/usr/lib/eggdrop/modules/filesys.so
/usr/lib/eggdrop/modules/irc.so
/usr/lib/eggdrop/modules/notes.so
/usr/lib/eggdrop/modules/seen.so
/usr/lib/eggdrop/modules/server.so
/usr/lib/eggdrop/modules/share.so
/usr/lib/eggdrop/modules/transfer.so
/usr/lib/eggdrop/modules/uptime.so
/usr/lib/eggdrop/modules/wire.so
/usr/share/doc/eggdrop/upstream

Just by skimming over this I can see that the program has documentation in /usr/share/doc/eggdrop and the binary is in /usr/bin/eggdrop and lastly there are libraries in /usr/lib/eggdrop. Of course parsing this mentally requires some knowledge of the Linux file structure, but even without you should still be able to find what you need by looking in those folders.


  • Del.icio.us
  • StumbleUpon
  • Reddit
  • Twitter
  • RSS

Leave a Reply