In this tutorial I'm going to show how to list the installed packages on a Debian based operating system, (Debian, Ubuntu, Mint, Sidux, CrunchBang, etc.) I got this gem of a command line one-liner from the Sidux website.
This command is useful if you want to replicate a GNU/Linux installation from one computer to another.
For those who are impatient, I'll cut right to the chase. This command will create a file in your home directory called installed.txt that contains the listing of your installed packages. Open a terminal and enter:
Let's break down the command to see what the different part do. The first portion,
lists all of the packages in the available repositories, whether they're installed or not. This listing is then pipelined into
which filters the list to only those packages that are installed. The list is further filtered by pipelining the output to
which eliminates package names that begin with "lib", contain "dev", or contain the revision of your currently running kernel. The final portion of the command,
uses the ">" to redirect the output to your text file.
#
#
dpkg has a integrated service to provide such a replication.
You can get a list of installed packages, with option "--get-selections" and set the list to install with option "--set-selections".
So to replicate an installation you may want to use : "dpkg --get-selections > installed.txt" on the first host and "dpkg --set-selections < installed.txt"
If you want, you can still add a command to dpkg --get-selections to filter some package as you did.
#
@Nicolas - Thanks for the tip! This is what I love about blogging. Post a solution to a problem and someone leaves a comment with an even better way!
#