adrift in the sea of experience

Thursday, February 21, 2008

Finding debian packages and listing the files installed by them

The great thing about GNU/linux distributions is that they come with zillions of software packages, downloadable over the internet from free software repositories. Say you notice that your firefox browser doesn't support java applets. In debian, you're just a

apt-cache search java mozilla

away from finding a package providing just what you need. One of the results returned on my machine by the above command was "sun-java6-plugin". Just do

apt-get install sun-java6-plugin

and you're done! No need to worry about dependencies (like, ehm, java!), those are also downloaded and installed as needed.

Using an installed package

When you install an application "foo", typically it will be in a package named "foo" and will be launchable by typing "foo" in the console. In the case of command line tools, typing "man foo" will bring up one of those fascinating manual pages. In the case of GUI tools, they should be automagically added to your start menu in your favorite window manager. So far so good.

Unfortunately, a minority of the packages are a bit evil in this aspect. The "bittorrent" package for example provides the original bittorrent implementation as a set of command line tools. You can install it, but you'll find that no "bittorrent" command becomes available, nor will "man bittorrent" give any results. "apt-cache show bittorrent" doesn't provide much hints either. Where the hell are my command line tools?!

There is a solution! It took me a while to find, but it is to do a

dpkg -S bittorrent|grep bin

which will list all the invokable binaries installed by the bittorrent package. Turns out that the tool is invokable as btdownloadcurses.bittorrent (thank you tab completion!).

Getting started with a new programming library

This is also very handy for other types of packages for which it may not be obvious how to start using them, like programming libraries. Suppose you want to write a little script to upload your pictures to google's picasaweb service. A quick

apt-cache search picasa

will yield the "python-gdata" package. Once installed,

dpkg -S python-gdata

will help you locate all the new python goodness at your disposal. In this case, it turns out that alot of sample scripts are installed at /usr/share/doc/python-gdata to help you get started.

No comments: