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 whatpackage it was in. Now, you can always google of course, but you can also usesystem 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 belongsto, 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, whichfetch & build a database of all apt packages and their contents, so you caneasily 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 wecan 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.
http://kvz.io/blog/2008/11/08/search-for-a-package-with-aptfile/
本文介绍了如何在Ubuntu系统中使用dpkg和apt-file命令来查找特定文件或命令所属的软件包。首先通过dpkg -S 命令定位已安装文件的归属,接着介绍如何安装并使用apt-file搜索未安装的包,最终找到所需软件。
664

被折叠的 条评论
为什么被折叠?



