» Search for a package with apt-file

On twitter

Recently I needed ogg123 on an Ubuntu server to convert some media. Naturally, I wanted to use aptitude to install it, but I didn't know what package it was in. Now, you can always google of course, but you can also use system commands to find the package you need.

Already have the file? Use dpkg

If you already have the file, and just want to know which package it belongs to, you can use dpkg like this:

dpkg -S $(which ogg123)

(replace ogg123 with the command you are looking for)

Don't have it yet? Use apt-file

I didn't have the package yet, so dpkg doesn't know about it either.

In this case you can install a nifty little program called apt-file, which fetch & build a database of all apt packages and their contents, so you can easily find what you need.

Installing apt-file

Ok, let's install apt-file first.

aptitude install apt-file

apt-file works just like apt, so we need to update it's database before we can use it.

apt-file update

Search

Now we're ready to search for our package:

apt-file search ogg123

Which in my case returned:

irssi-scripts: /usr/share/irssi/scripts/ogg123.pl
python-pyvorbis: /usr/share/doc/python-pyvorbis/examples/ogg123.py
vorbis-tools: /usr/bin/ogg123
vorbis-tools: /usr/share/doc/vorbis-tools/examples/ogg123rc-example
vorbis-tools: /usr/share/man/man1/ogg123.1.gz

Very well, vorbis-tools it is!

aptitude install vorbis-tools

You've just got to love the apt.

Stay up to date

You can track my blog rss articles and rss comments. You may also find my rss bookmarks interesting. Or twitter Follow me on Twitter


Like this article?

   Then Digg it!
Or use another bookmark button below to show your support &
help me spread the word.


tags: ubuntu, apt, dpkg, aptfile
category: Howto - System
read: 3,426 times

Add comment

(required, shown)(required, not shown)for syntax highlighting

[CODE="Javascript"]
your_code_here();
[/CODE]

Replace "Javascript"
with "php", "text", etc.
code (to make sure you are not a spammer)

 Track replies: rss feed comments feed

Comments

#4. Kevin on 21 February 2010

Twitter.com: kvz@ Dejan Ranisavljevic: apt-cache search is nice (please use aptitude search from now on, though), but is not at all the same as apt-file search. Try finding out which package contains a specific binary file with apt-cache.

#3. Dejan Ranisavljevic on 26 January 2010

Gravatar.com: Dejan RanisavljevicI get used to apt-cache search already. But anyway nice tip :)

#2. Kevin on 10 November 2008

Twitter.com: kvz@ Robin: Try looking for ogg123 with aptitude (or apt-cache for that matter):

aptitude search ogg123

It won't find anything because it cannot search the packages' files. Hence you will only get results when you already know the package name vorbis-tools or some part of the description.

#1. Robin on 10 November 2008

Gravatar.com: RobinGood tip! always handy, features like these...

One question though, in which respect is `apt-file search` different than `apt-cache search`? Other than the fact apt-cache is already part of the aptitude package?