Subscribe to How-To Geek

Using Ubuntu: What Package Did This File Come From?

How many times have you noticed a file sitting in a directory and wondered… where did this file come from?  Or you are trying to tell a friend how to use a utility but he doesn’t have it installed, and you can’t remember what package you installed to get it.

Sure, you can head over to google, but don’t you always wonder how those people know? It’s simple, install the dlocate utility, which is a faster alternative to dpkg for this type of query.

sudo apt-get install dlocate

You can use the command with the syntax ‘dlocate <filename>’, which will give you this output:

$ dlocate flac

libxine1: /usr/lib/xine/plugins/1.1.4/xineplug_flac.so
libtunepimp5: /usr/lib/tunepimp/plugins/flac.tpp
gstreamer0.10-plugins-good: /usr/lib/gstreamer-0.10/libgstflac.so
flac: /.
flac: /usr
flac: /usr/bin
flac: /usr/bin/flac
—– trimmed ——

That’s a lot of output! You can see that there are a lot of filenames that partially match. Better to pass the full path to the filename. In this case, you can use ‘which flac’ to determine which flac command you are using, and then pass the full path to dlocate.

$ which flac

/usr/bin/flac

$ dlocate /usr/bin/flac

flac: /usr/bin/flac

Now we know that the flac command is found in the package called “flac”. (Yes, this example was very simple) You could even get more creative (use the character next to the 1 key, not a single quote)

$ dlocate `which flac`

flac: /usr/bin/flac

If you don’t feel like installing another utility, you can use the ‘dpkg -S <filename>’  command that is built in, but the output isn’t nearly as fast or organized. Just make sure you pass the full path of the file to either utility and you should get good results.

| More
This article was originally written on 06/19/07 Tagged with: Ubuntu

Daily Email Updates

You can get our how-to articles in your inbox each day for free. Just enter your name and email below:


Name:
Email:

Leave a Comment




Leave your friendly comment here.

If you have a computer help question, click here to leave it on the forums instead.

Note: Your comment may not show up immediately on the site.

Our Friends
Getting Started


About How-To Geek
What Is That Process?
svchost.exe
jusched.exe
dwm.exe
ctfmon.exe
wmpnetwk.exe
wmpnscfg.exe
rundll32.exe
wfcrun32.exe
Ipoint.exe
Itype.exe
Wfica32.exe
Mobsync.exe
conhost.exe
Dpupdchk.exe Adobe_Updater.exe

Copyright © 2006-2009 HowToGeek.com. All Rights Reserved.