-2

I sometimes see update commands for Ubuntu which make it twice as this sample

sudo apt-get update && sudo apt-get upgrade

I wonder why do we have to call it twice like that? Why not just once?

Nam G VU
  • 2,268
  • Thank you! I see full clear details for me there at this answer http://askubuntu.com/a/222352/22308 – Nam G VU Nov 06 '14 at 03:03

1 Answers1

4

Those are two different commands. This one:

sudo apt-get update

Says to update the package index file. If there is a newer version of a package available, replace it in the index.

sudo apt-get upgrade

Says to compare all the packages installed on the system to the updated package index and offer all upgrades available.

chili555
  • 60,188
  • 1
    So in short, update is for checking for new updates, and upgrade is for install the update(s). Is it right? – Nam G VU Nov 06 '14 at 02:46
  • 1
    More or less. You can see an even more exact description with the command: man apt-get. – chili555 Nov 06 '14 at 02:49
  • Thank you! Clear to me now. I see full detail here http://askubuntu.com/a/222352/22308 – Nam G VU Nov 06 '14 at 03:03
  • In short, update is for updating the local index of packages from the repository and upgrade is for performing an upgrade of all packages for which a newer version is known in the index. – thomasrutter Nov 06 '14 at 04:47