LOGO

List Installed Packages on Ubuntu/Debian - How To

October 8, 2007
List Installed Packages on Ubuntu/Debian - How To

Identifying Installed Packages with dpkg

When compiling MonoDevelop from source code, the dpkg and apt-cache commands proved invaluable in determining which packages were already present on the system versus those available in the software repository. Following the completion of that guide, it became apparent that a dedicated explanation of how to display currently installed packages would be beneficial. This article addresses that need.

The primary command for listing installed packages is dpkg --get-selections. Executing this command generates a comprehensive list of all packages currently installed on the system.

dpkg --get-selections

adduser install

alsa-base install

alsa-utils install

apache2 install

apache2-mpm-prefork install

apache2-utils install

apache2.2-common install

apt install

apt-utils install

Filtering Package Lists with grep

The output from dpkg --get-selections can be extensive. To streamline the process, filtering the results using grep is highly recommended. This allows you to quickly locate information for specific packages.

For example, to determine which PHP packages are installed via apt-get, the following command can be used:

dpkg --get-selections | grep php

libapache2-mod-php5 install

php-db install

php-pear install

php-sqlite3 install

php5 install

php5-cli install

php5-common install

php5-gd install

php5-memcache install

php5-mysql install

php5-sqlite install

php5-sqlite3 install

php5-xsl install

Locating Package Files with dpkg -L

To discover the file locations associated with a specific package, the dpkg -L command can be employed. This command provides a detailed listing of all files installed by the designated package.

As an illustration, to find the files belonging to the php5-gd package, use the following command:

dpkg -L php5-gd

/

/usr

/usr/lib

/usr/lib/php5

/usr/lib/php5/20060613

/usr/lib/php5/20060613/gd.so

/usr/share

/usr/share/doc

/etc

/etc/php5

/etc/php5/conf.d

/etc/php5/conf.d/gd.ini

/usr/share/doc/php5-gd

With this information, configuration files like gd.ini can be accessed and modified to adjust settings as needed.

#Ubuntu#Debian#installed packages#list packages#package management#apt