0

I have 12.04 and I'm looking for a way to store all the currently installed packages names into a file or archive. Not the packages themselves, but the names. Or the package management's state.

I'd like to do this in order for the ability to synchronize the installed packages on demand on two computers. The idea would be to save the installed names on computer A, go to computer B, make a diff of the names and uninstall extra packages from B and install the missing ones.

For this it would be good if the version could also be saved for each package. Also I'm not sticking to the names if there is something that better suits my scenario, something that the package management can work with as automatic as it can be.

Out of preference, I'd like to do it without the use of a sync-server. Looking for file-based solutions.

n611x007
  • 555

2 Answers2

1

This command will give you all the installed packages and their respective versions:

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

Or even shorter (the above command is the default output for -W):

dpkg-query -W

See dpkg-query man pages for further format options.

To backup and restore your packages, please see this answer.

0

You could also run the below command to list the installed packages along with their versions.

dpkg -l | awk '{print $2,$3}'
Avinash Raj
  • 78,556