Server Fault is a question and answer site for system and network administrators. 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

I am thinking of getting a VPS and using Ubuntu with it. I've installed linux on home servers and I almost always choose a very bare system and then install packages manually after the install is complete.

However for a VPS, some providers have pre-made images that can be used. If I were to use one of them, what is the easiest way of finding out/listing what is already installed, including things like locations and versions?

share|improve this question

dpkg -l will give you a list of all the applications installed on a debian based box. For more info, check this page.

Also, dpkg -L <pkgname> shows the files installed for .

share|improve this answer
sorry for the late reply. that works great but what about for Red Hat based installs like CentOs? – blndcat Jul 24 '09 at 16:56
@blindcat - just left an answer with the rpm-based answer – warren Oct 2 '09 at 6:32

Some other useful tricks: if you install "debian-goodies", you'll have the "dpigs" command to display installed package sorted by disk space usage.

Another useful trick if you want to make several similar installations : use

dpkg --get-selections > installedpackages.txt

On the installed machine then transfer the file to the new machine, and

   cat installedpackages.txt | dpkg --set-selections

Then do

apt-get -u dselect-upgrade

And wait :)

share|improve this answer
Useless use of cat detected; you can do just 'dpkg --set-selections < installedpackages.txt' ;) – janneb Jun 28 '09 at 19:34
Rhaaa I knew it but I was too lazy to check, I just copied and pasted from my notebook :) – wazoox Jun 29 '09 at 10:00
dpkg --get-selections | ssh othermachine dpkg --set-selections` works, too :) – Janne Pikkarainen Jul 15 '12 at 12:20

On CentOS/RHEL/Fedora/etc:

rpm -qa | sort

Query the rpm database for all packages, and put them in alphabetical order :)

Afterwards, I'd rely on using yum to manage the packages, rather than rpm directly, as it will also handle dependencies.

share|improve this answer
sudo dpkg -l > packageslist
more packageslist
share|improve this answer
dpkg -l doesn't need superuser access. – janneb Jun 28 '09 at 19:27
If u have superuser access it is better to get result – Rajat Jun 29 '09 at 5:38

Your Answer


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.