Debian-goodies: A must-have Set of Utilities For Debian/Ubuntu Administrators

Are you a Debian/Ubuntu Administrator or a regular user, then you may use the dpkg and APT commands often. These commands are used to install, remove, update or upgrade a package or the whole system. Mostly, we use the above two tools only for our day to day operations, But believe me, there are many useful commands are exist that most users aware of.

If you want to know which packages occupy the most disk space, or which package might have broken another, or to get a most recent version of a package, or just to get a particular version of a package, then you probably need Debian-goodies.

According to the Official site,

Debian-goodies are a set of small toolbox style of utilities for Debian, and derivatives. These programs are designed to integrate with shell tools, extending them to operate on the Debian packaging system.

In-fact, Debian-goodies will bring more information than dpkg, and apt tools. In this tutorial, let us explore some useful Debian-goodies utilities.

First, let us install debian-goodies on our system using the following command. This command should work on Debian, Ubuntu, and its derivatives.

sudo apt-get install debian-goodies

Usage

1. dgrep Utility

This utility will search all files for a particular pattern or regex in a specified package, whereas “grep” utility search specified regex in a specified file.

Example:

To search a word “mozilla” in the firefox package, run the following command

sudo dgrep "mozilla" firefox

Sample output:

[…]

/usr/lib/firefox/distribution/searchplugins/locale/en-GB/google.xml:<SearchPlugin xmlns="http://www.mozilla.org/2006/browser/search/">
 /usr/lib/firefox/distribution/searchplugins/locale/en-GB/wikipedia.xml:   - file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
 /usr/lib/firefox/distribution/searchplugins/locale/en-GB/wikipedia.xml:<SearchPlugin xmlns="http://www.mozilla.org/2006/browser/search/">
 /usr/lib/firefox/distribution/searchplugins/locale/en-GB/chambers-en-GB.xml:   - file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
 /usr/lib/firefox/distribution/searchplugins/locale/en-GB/chambers-en-GB.xml:<SearchPlugin xmlns="http://www.mozilla.org/2006/browser/search/">

To view the list if installed packages in your Debian based system, run the following command:

dpkg -l

2. dglob Utility

This utility will list package names matching a specified string. By default, it will list only the installed packages. If you want to list all packages, use the flag “-a”.

Example:

sudo dglob firefox

Sample output:

firefox
firefox-locale-en

3. debget Utility

This command is somewhat similar to apt-get tool. Apt-get will download and install a specified package, but debget command will download a specified package from a public mirror, and saves the downloaded package in the current directory.

Example:

sudo debget transmission

Sample Output:

(transmission -> 2.82-1.1ubuntu3.1)
(transmission -> 2.82-1.1ubuntu3)
Downloading transmission from http://archive.ubuntu.com/ubuntu/pool/universe/t/transmission/transmission_2.82-1.1ubuntu3.1_all.deb
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100  1200  100  1200    0     0    570      0  0:00:02  0:00:02 --:--:--   570

As you see in the above output, the transmission package is downloaded and saved in the current working directory.

4. dpigs Utility

This utility is one of the important and useful among other debian-goodies utitlities. It will display which installed package occupy the most space in your system. Be mindful that, It won’t show exact size of disk space occupied by a particular package, instead it will only show the name of the packages.

Example:

sudo dpigs

Sample output:

148409 linux-image-extra-3.13.0-37-generic
148328 linux-image-extra-3.13.0-35-generic
147551 virtualbox-4.3
131814 libreoffice-core
120489 wine1.6-amd64
115449 wine1.6-i386
87671 firefox
82957 fonts-horai-umefont
75667 libreoffice-common
64375 linux-firmware

As you see above, the dpigs command displays the top 10 installed packages which use most space along with their process id. If you want to display more packages, then use the flag “n” as shown below.

For example, let us bring the top 15 packages that use most space.

dpigs -n 15

Sample output:

148409 linux-image-extra-3.13.0-37-generic
148328 linux-image-extra-3.13.0-35-generic
147551 virtualbox-4.3
131814 libreoffice-core
120489 wine1.6-amd64
115449 wine1.6-i386
87671 firefox
82957 fonts-horai-umefont
75667 libreoffice-common
64375 linux-firmware
61822 linux-headers-3.13.0-37
61820 linux-headers-3.13.0-35
56274 openjdk-7-jre-headless
45906 wine-mono0.0.8
41094 linux-image-3.13.0-37-generic

5. checkrestart Utility

This is another useful tool in the debian-goodies family. It will notify you the list of services that you need to restart after upgrading your system. As you may know, after you upgrade your system, some running applications might use the old libraries or configuration files. So you can quickly find out which processes need to be restarted after installing a software. So checkrestart will audit the system to find out the outdated versions of libraries in use.

Example:

Please note that you should run this command as root user.

sudo checkrestart

Sample output:

lsof: WARNING: can't stat() fuse.gvfsd-fuse file system /run/user/1000/gvfs
      Output information may be incomplete.
Found 0 processes using old versions of upgraded files

As per the above result, I don’t need to restart any services.

6. dhomepage Utility

dhomepage will take you directly to the website of any specified package. This tool will be very useful if you are looking for more details of any package.

Example:Example:

dhomepage transmission

The above command will automatically open the transmission home page in your default browser.

Transmission - Mozilla Firefox_001

Very cool, isn’t it?

7. which-pkg-broke Utility

This is yet another useful utility in the debian-goodies list. It will display the list of a specified package along with all its dependencies including the time of installation. So if something went wrong when upgrading the system or a package, you can easily find, at what time, and which packages have broken your system.

Example:

For example, if firefox didn’t work properly, you can find out which package is responsible for the breakage as shown below.

which-pkg-broke firefox

Sample output:

Package ttf-bitstream-vera has no install time info
Package <debconf-2.0> has no install time info
Package gsfonts-x11 has no install time info
debianutils                                            Wed Jul 23 04:30:56 2014
debconf                                                Wed Jul 23 04:30:56 2014
coreutils                                              Wed Jul 23 04:30:56 2014
liblzma5:amd64                                         Wed Jul 23 04:30:57 2014
libacl1:amd64                                          Wed Jul 23 04:30:57 2014
libdb5.3:amd64                                         Wed Jul 23 04:30:57 2014
libattr1:amd64                                         Wed Jul 23 04:30:57 2014
libbz2-1.0:amd64                                       Wed Jul 23 04:30:57 2014
[...]

This list is not over. Debian-goodies has lot of the more useful utilities. Though we might not use all of them regularly, but they are worth to learn. They will be very useful at the right time for sure.

Cheers!