Differences between revisions 51 and 53 (spanning 2 versions)
Revision 51 as of 2015-06-26 14:21:30
Size: 3354
Editor: ?MichaelRedman
Comment: Added command to list package names only, 1 per line
Revision 53 as of 2015-08-02 05:21:08
Size: 3443
Editor: ?RomeoPapa
Comment: The dpkg --get-selections >/backup/package-selections will definitely overwrite the package-selections file, making the next line totally useless.
Deletions are marked like this. Additions are marked like this.
Line 8: Line 8:
=== List all packages installed === === List all installed packages ===
Line 16: Line 17:
dpkg --get-selections | cut -f 1 dpkg-query -f '${binary:Package}\n' -W
Line 18: Line 19:
Line 31: Line 33:
dpkg -l | more dpkg-query -l '*' | less
Line 34: Line 36:
This will show all packages (1 line each) that are in various stages of install (this includes packages that were removed but not purged). To show only the installed: This will show all packages (one line each) that are in various stages of installation (including packages that were removed but not purged) and packages just available from a repository. To show only installed packages:
Line 37: Line 39:
dpkg -l | grep '^i' dpkg -l | grep '^.i'
Line 40: Line 42:
to filter through grep to get results for "i" you can filter with grep to get results for "i".
Line 47: Line 49:
You can if you are using Debian Linux use dpkg command to list installed software:
Or you can use dpkg to list the current package selections (the desired state of either installed or to be installed packages):
Line 52: Line 55:
And store the list installed software to a file called /backup/installed-software.log
And store the list of software to a file called /backup/package-selections
Line 55: Line 59:
dpkg --get-selections > /backup/installed-software.log dpkg --get-selections >/backup/package-selections
Line 61: Line 65:
 * {{{/var/lib/dpkg/available}}}: list of available packages.
 * {{{/var/lib/dpkg/status}}} :statuses of available packages. This file contains information about whether a package is marked for removing or not, whether it is installed or not, etc. A package marked reinst-required is broken and requires reinstallation.
 * {{{/var/lib/dpkg/available}}}: list of available packages from repositories.
 * {{{/var/lib/dpkg/status}}}: status of installed (and available) packages.  This file contains information about whether a package is marked for removal or not, whether it is installed or not, etc. A package marked reinst-required is broken and requires reinstallation.
Line 72: Line 76:
Then you have to type following commands: Then you have to type following command:
Line 75: Line 79:
dpkg --get-selections > /backup/installed-software.log
dpkg --set-selections < /backup/installed-software.log
dpkg --set-selections </backup/package-selections
Line 78: Line 81:
Now your list is imported use apt-get, [[Synaptic]] or other PackageManagement tools. To install the package:
Now that your list is imported use apt-get, [[Synaptic]] or other PackageManagement tools. To install the packages:
Line 85: Line 89:
Line 86: Line 91:
aptitude install $(cat /backup/installed-software.log | awk '{print $1}') aptitude install $(cat /backup/package-selections | awk '{print $1}')
Line 90: Line 95:
Line 95: Line 101:

Translation(s): English - Français - Italiano - 日本語(Nihongo)

(!) ?Discussion


This page is about the ways to list the installed packages in a Debian system and how to create a file with this list. This file can be uploaded to the web (i.e. from other computer with Internet connection) to download new packages.

List all installed packages

With version and architecture information, and description, in a table:

dpkg-query -l

Package names only, one per line:

dpkg-query -f '${binary:Package}\n' -W

List packages using a search pattern

It is possible to add a search pattern to list packages:

dpkg-query -l 'foo*'

Show status of all packages on the system

To check the status of all packages on your system:

dpkg-query -l '*' | less

This will show all packages (one line each) that are in various stages of installation (including packages that were removed but not purged) and packages just available from a repository. To show only installed packages:

dpkg -l | grep '^.i'

you can filter with grep to get results for "i".

You can also use:

apt-cache pkgnames

Or you can use dpkg to list the current package selections (the desired state of either installed or to be installed packages):

dpkg --get-selections

And store the list of software to a file called /backup/package-selections

dpkg --get-selections >/backup/package-selections

You can also find package information in the next directories (you can use mc or other FileManager to browse them):

  • /var/lib/apt/lists/*

  • /var/lib/dpkg/available: list of available packages from repositories.

  • /var/lib/dpkg/status: status of installed (and available) packages. This file contains information about whether a package is marked for removal or not, whether it is installed or not, etc. A package marked reinst-required is broken and requires reinstallation.

Restore installed software

After re-installing base system you can immediately re-install all software. You need dselect:

apt-get install dselect

Then you have to type following command:

dpkg --set-selections </backup/package-selections

Now that your list is imported use apt-get, Synaptic or other PackageManagement tools. To install the packages:

apt-get dselect-upgrade

All this with a single command:

aptitude install $(cat /backup/package-selections | awk '{print $1}')

See also


CategoryPackageManagement