Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Possible Duplicate:
How do you track which packages were installed on Ubuntu (Linux)?


I'm using apt-get install to install various software on my PC. I have a handful of PCs that needs the same software packages installed all over them. How can I get list of software installed via apt-get install and the sequence in what the packages are installed. Okay, the sequence is not so important since the package manager resolves dependencies... I want to create a script that once run installs all needed software on the other PCs. All of these PCs are Ubuntu default installations. It is obvious that the packages list must not include all the packages that are installed trough a default installation :)

Also that list should not contain software installed via synaptic or dpkg if possible.

share|improve this question

marked as duplicate by Sathya, quack quixote Apr 19 '10 at 22:21

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

This is probably duplicate of… – vava Apr 19 '10 at 18:16
indeed, the duplicate's accepted answer answers both parts of this question. – quack quixote Apr 19 '10 at 22:23
up vote 2 down vote accepted

You can save a list of installed packages on the old machine with the command dpkg --get-selections > ~/packages and then restore it on the new one with sudo dpkg --set-selections < ~/packages && apt-get dselect-upgrade.

You shouldn't have to worry about the default install having a load of stuff already included, apt-get will look after everything for you.

You are going to end up with several text files called packages listing the packages that need installing on each machine. If you want you can add all these together and then get rid of duplicates using uniq, meaning that you would then have one set of packages to install rather than one set from each machine.

share|improve this answer
To combine them together, you would write something like cat file1 file2 file3 | sort | uniq > outputfile – davr Apr 19 '10 at 16:55

aptitude can do what are you looking for and much more, actually.

aptitude search '?installed ?not(?automatic)'

Or shorter:

aptitude search '~i!~M'

will list all the packages installed manually. None of the dependent (i.e., like mysql-data, or *-common, that are installed automatically) packages will be listed.

If you want just package names, use -F '%p' parameter.

You can check out search patterns reference, there's virtually no criteria it can't search for.

share|improve this answer

Not the answer you're looking for? Browse other questions tagged .