Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

apt-cache dump --installed doesn't work, it lists uninstalled packages as well.

I want to list the install packages each by one line, with the installed version number.

share|improve this question

6 Answers 6

up vote 31 down vote accepted

try dpkg -l

it lists you the packages, version and a short description.

share|improve this answer

Simplest, but might show a few extraneous packages and truncates long package names and version numbers:

dpkg -l

To list only correctly installed packages and not truncate names:

dpkg -l | grep '^ii'

To get more control over the output format, you can use dpkg-query:

dpkg-query -W -f '${status} ${package} ${version}\n' |
sed -n 's/^install ok installed //p'
share|improve this answer
apt-show-versions

It also gives you info about the package state (up to date, upgradable, ...)

This program is separately packaged in the apt-show-versions package. Install it first with:

apt-get install apt-show-versions
share|improve this answer

To list the names of each installed package, type as a superuser :

dpkg --get-selections

You will get an output like this :

accountsservice              install
aclinstall                   install
acpi-supportinstall          install
acpidinstall                 install
...

To remove the unecessary "install" character string, you can use sed :

dpkg --get-selections | sed 's:install$::'

And if yout want to save it to a file called InstalledPackages, you type this :

dpkg --get-selections | sed 's:install$::' > InstalledPackages
share|improve this answer

The following command is a solution that additionally can help to install the listed packages in their listed versions later again (on the same or another system):

aptitude -q -F "%?p=%?V %M" --disable-columns search \~i > pkg-selections.txt

Each line will contain package name, version and an optional "A" if the package was installed automatically.

Source: "Cloning a Debian system - identical packages and versions". See there too for a little script to re-setup a system from the saved list of packages and versions.

share|improve this answer

If you do not have access to live system, and have a backup of root/ partition, you can :

root@backup_server /mnt/old_root/var/lib/dpkg/info # ls -la *.list | awk {'print $9'}| sed 's/.list//' >> /root/installed_app

Now this /root/installed_app contain all installed packages!

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.