Search for a Package With apt-file

1 minute read

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

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.

Leave a Comment Right Here