dpkg –get-selections: Get the Current State of Your Ubuntu/Debian machine

dpkg can be used for a variety of purposes. It can be used to install and remove packages. But one of the best feature which you can use is to save the current state of your machine.

What is current state of your machine?
You may be wondering what does the current state means. Your ubuntu/debian machine is a collection of many packages. Every time your machine crashes, apart from losing the valuable data, you may also lose the information about various packages you installed in your machine.

dpkg –get-selections gives the list of all package names and their current state like installed, deinstalled etc.

$ dpkg --get-selections 

acpi-support                                    install
acpid                                           install
adduser                                         install
adium-theme-ubuntu                              install
aisleriot                                       install
akonadi-server                                  install
....

You can save the settings into a file using tee.

$ dpkg --get-selections | tee packages_list

acpi-support                                    install
acpid                                           install
adduser                                         install
adium-theme-ubuntu                              install
aisleriot                                       install
akonadi-server                                  install
....

You can make use of the file packages_list in many ways. Save it in your mail, so that you can use it later or even use it to clone another machine in a similar way.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s