[Snippet] Ubuntu: Backup Your Applications Easily With A Single Command

Installing applications in Ubuntu is as easy as the app store in iPhone. Hit the Ubuntu Software Center, find the application you want and click Install. Due to this convenience, most of the time, you won’t need to backup the applications itself.

However, there are times when you want to restore the newly formatted machine to the original state and you find it a chores to manually install all the applications again. This is when the backup is useful.

When we say “backup” in this case, we don’t really mean backing up the actual application. What we are going to do is to export the list of all your installed app onto a text file. Next time, we can just get the system to reinstall the apps listed in the text file.

Backing up your Apps

(Optional) To list all your installed applications, open a terminal and type:

sudo dpkg --list

To backup your list of applications to a text file:

sudo dpkg --get-selections > app-backup-list.txt

This will create a text file of the name “app-backup-list.txt” in your Home folder.

To restore your applications, first make sure that the app-backup-list.txt file is in your Home folder, then type in the terminal:

sudo dpkg --get-selections < app-backup-list.txt
sudo apt-get -y update
sudo apt-get dselect-upgrade

Note: This will only reinstall the applications. It won’t restore back the settings that you have previously set. You might want to back up the whole Home folder to preserve all your settings.

That’s it.

Image credit: cesarastudillo