How to list all installed packages

From EasyPeasy Wiki

Jump to: navigation, search

This is very useful for searching unnecessary packages or for fresh installations. :)

Contents

[edit] Create a new list

To create a list of all installed packages just open a terminal and type:

dpkg --get-selections > installed-packages

This creates a file named "installed-packages" which contains a list of all installed packages.

[edit] Work with the list

[edit] View

You can view this list line by line with:

less installed-packages

[edit] Search

Search through the list with:

grep <Keyword> installed-packages

[edit] Reinstall all the packages

If you want to install all packages on the list type:

sudo dpkg --set-selections < installed-packages


[edit] Other ways to use 'dpkg'

[edit] Search for specific packages

If you kind of know what you are looking for you don't have to create a list as in the above:

dpkg -l | grep <package you are looking for>

example:

root@box1:~# dpkg -l | grep kernel
ii  ipmitool                              1.8.8-3.1                           utility for IPMI control with kernel driver 
ii  linux-image-2.6.24-19-server          2.6.24-19.41                        Linux kernel image for version 2.6.24 on x86
ii  linux-image-server                    2.6.24.19.21                        Linux kernel image on Server Equipment.
ii  linux-server                          2.6.24.19.21                        Complete Linux kernel on Server Equipment.
ii  module-init-tools                     3.3-pre11-4ubuntu5                  tools for managing Linux kernel modules
ii  udev                                  117-8                               rule-based device node and kernel event mana

[edit] Show the files that a package installs

You will need exact package name generated in the last tip for this:

 dpkg --listfiles <specific installed package name>

Example:

root@box1:~# dpkg --listfiles linux-server
/.
/usr
/usr/share
/usr/share/doc
/usr/share/doc/linux-server
/usr/share/doc/linux-server/copyright
/usr/share/doc/linux-server/changelog.gz
Personal tools