Saturday 20 September 2008

Tip of the Day: Use apt-file in Ubuntu 8.04

apt-file is a command line tool which allows you to see all the files which a package will install, and their location. For example, the output of apt-file show vorbis-tools on a Ubuntu 8.04 box will be:

ubuntu@ubuntu:~$ apt-file show vorbis-tools
vorbis-tools: /usr/bin/ogg123
vorbis-tools: /usr/bin/oggdec
vorbis-tools: /usr/bin/oggenc
vorbis-tools: /usr/bin/ogginfo
vorbis-tools: /usr/bin/vcut
vorbis-tools: /usr/bin/vorbiscomment
vorbis-tools: /usr/bin/vorbistagedit
vorbis-tools: /usr/lib/mime/packages/vorbis-tools
vorbis-tools: /usr/share/doc/vorbis-tools/README.Debian
vorbis-tools: /usr/share/doc/vorbis-tools/changelog.Debian.gz
vorbis-tools: /usr/share/doc/vorbis-tools/copyright
vorbis-tools: /usr/share/doc/vorbis-tools/examples/ogg123rc-example
vorbis-tools: /usr/share/man/man1/ogg123.1.gz
vorbis-tools: /usr/share/man/man1/oggdec.1.gz
vorbis-tools: /usr/share/man/man1/oggenc.1.gz
vorbis-tools: /usr/share/man/man1/ogginfo.1.gz
vorbis-tools: /usr/share/man/man1/vcut.1.gz
vorbis-tools: /usr/share/man/man1/vorbiscomment.1.gz
vorbis-tools: /usr/share/man/man1/vorbistagedit.1.gz

As you can see, it shows all the files (including binaries) which are installed by the package vorbis-tools.

To install apt-file, just use:

sudo apt-get install apt-file

The next step is to update its cache:

sudo apt-file update

Search for a specific file in the packages
Sometimes you remember the name of a tool but forget what package contains it. For example, to see in which package the shnsplit tool is included, you can execute:

ubuntu@ubuntu:~$ apt-file search shnsplit
shntool: /usr/bin/shnsplit
shntool: /usr/share/man/man1/shnsplit.1.gz

As you can see, shntool is the package we are looking for.

Updated: Sep 20, 2008

1 comment:

Anonymous said...

Oldtimers will tell you dpkg -L package and dpkg -S filename will do the same without installing anything.