Ask Ubuntu is a question and answer site for Ubuntu users and developers. 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

What is the difference between the following?

sudo apt-get update
sudo apt-get upgrade


dpkg --get-selections | grep -v deinstall > ubuntu-files


sudo dpkg --set-selections < ./ubuntu-files
sudo apt-get -y update
sudo apt-get -u dselect-upgrade
share|improve this question
Manual that explains it all and more: – Rinzwind Nov 18 '11 at 9:26
in sudo apt-get -u dselect-upgrade what does dselect do – Newbi Nov 18 '11 at 9:48
By the way... your code is flawed. I added i a - and sudo apt-get -y update. Plus I put a break in the last set: the 1st command you issue on your OLD install. The other 3 on the new install ;) – Rinzwind Nov 18 '11 at 9:59
up vote 1 down vote accepted

The 1st part is just a normal update/upgrade.

The last part is about saving your package list and restoring them into a new system.

Let's say you have a crashed system and can get to a commandprompt.

pkg --get-selections|grep -v deinstall>ubuntu-files makes a file list of all installed packages (when using apt-get!). You save that file on a FDD, USB stick or disc.

After you installed your new system you copy that backup to /tmp/ and sudo dpkg --set-selections <./ubuntu-files will set it up and

apt-get -y update
apt-get dselect-upgrade

will install only those packages you had installed (with apt-get) in the older system.

share|improve this answer
why should we do "apt-get dselect-upgrade" what will happen if i do "apt-get upgrade" – Newbi Nov 18 '11 at 11:14
Like it said in the answer: dselect installs the selected files from the file. upgrade will upgrade -all- packages. – Rinzwind Nov 18 '11 at 11:20

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.