Searching for a package

Many a time, we know a part of an app we’re searching for, but dont know the exact package name. Did you know that apt (as does portage) has a command for listing a list of packages (from its cache) based on a regex search?

apt-cache search 'regex query'[/code]

This searches the package names and description for a match

If you'd like to search the package name and file lists alone, use:

dpkg -S 'regex query'[/code]

Installing package from source:
Note that you need to install a few packages like dpkg-dev to build packages from source.

sudo apt-get install dpkg-dev dh-autoreconf autopoint intltool gettext libglib2.0-dev libslang2-dev libx11-dev e2fslibs-dev check libgpm-dev[/code]

To download a source package, you would use the following command:

$ apt-get source packagename

This will download three files: a .orig.tar.gz, a .dsc and a .diff.gz. In the case of packages made specifically for Debian, the last of these is not downloaded and the first usually won't have "orig" in the name.

The .dsc file is used by dpkg-source for unpacking the source package into the directory packagename-version. Within each downloaded source package there is a debian/ directory that contains the files needed for creating the .deb package.

To auto-build the package when it's been downloaded, just add -b to the command line, like this:

$ apt-get -b source packagename
If you decide not to create the .deb at the time of the download, you can create it later by running:

$ dpkg-buildpackage -rfakeroot -uc -b
from within the directory that was created for the package after downloading. To install the package built by the commands above one must use the package manager directly, like this:

# dpkg -i file.deb

You are reading this post on Joel G Mathew’s tech blog. Joel's personal blog is the Eyrie, hosted here.