-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?

1

1 Answer 1

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.

4
  • 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 6, 2014 at 2:46
  • 1
    More or less. You can see an even more exact description with the command: man apt-get.
    – chili555
    Nov 6, 2014 at 2:49
  • Thank you! Clear to me now. I see full detail here askubuntu.com/a/222352/22308
    – Nam G VU
    Nov 6, 2014 at 3: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. Nov 6, 2014 at 4:47

Not the answer you're looking for? Browse other questions tagged .