You’ll often see two of common ways of updating Debian and Ubuntu-based distributions:sudo apt-get update && sudo apt-get upgrade sudo apt-get update && sudo apt-get dist-upgrade
The apt-get replace element updates the neighborhood bundle cache and for this reason tells your gadget approximately the programs that may be upgraded. However, many Linux customers get stressed among the usage of apt-get upgrade and apt-get dist-upgrade. Are they the same, or is there a distinction? In which instances must you operate apt-get improve and while must you operate apt-get dist-upgrade? In this article, I’ll provide an explanation for the distinction among apt-get improve and dist-upgrade. I’ll additionally talk how apt improve and apt full-improve do matters differently.
Difference between apt-get upgrade vs apt-get dist-upgrade
Both improve and dist-upgrade are used for upgrading the hooked up programs at the gadget. However, apt-get improve command can't despoliation a brand new bundle or cast off an hooked up bundle from the gadget. The dist-upgrade, on the alternative hand, can despoliation new programs or cast off current programs if required. It additionally manner you can't improve the Linux kernel model with apt-get improve. Why? Your gadget continues as a minimum kernels at a time. Because while there's a brand new kernel model is available, it's miles hooked up at the side of the only that is already in use.
Since it involves installing new packages, apt-get upgrade doesn’t upgrade the kernel. The dist-upgrade is a superset of upgrade. Apart from the improve function, it could additionally intelligently take care of modifications with inside the bundle dependencies. This consists of getting rid of dependency programs which can be not important or resolving conflicts among programs that arose due to modifications with inside the dependencies. It also can despoliation new programs if required. You can see with inside the screenshot that going for walks apt-get dist-upgrade now no longer handiest improvements hooked up programs however additionally installs the brand new kernel model.
It’s now no longer simply confined to kernel upgrade. When your gadget encounters situations wherein it has to put in or cast off (dependency) programs for upgrading the hooked up programs, dist-upgrade allows you. If you spot programs had been saved returned message, you may run the dist-upgrade or run apt-get despoliation on the ones programs explicitly.
Now, if you are looking to upgrade the distribution version, you should use dist-upgrade before starting the distribution upgrade so that all dependencies are handled properly. This DOES NOT mean that you run dist-upgrade command and your Ubuntu is upgraded to 22.04 from 20.04.
- apt-get upgrade only upgrades existing packages. It doesn’t install new packages or remove existing packages.
- apt-get upgrade doesn’t upgrade kernel version
- dist-upgrade can remove dependency packages or install new ones (if required)
- dist-upgrade can also upgrade kernel version
- dist-upgrade doesn’t upgrade the distribution version
Why not use dist-upgrade all the time then?
If you're a computer user, you can now no longer hassle much. But assume you're a gadget admin coping with mission-crucial servers going for walks diverse offerings with exclusive configured software. In that case, you can't permit the device determine the elimination of programs, irrespective of how ‘intelligent’ or ‘smart’ it's miles. You don’t need your meticulously configured gadget to act unusually due to the fact a few bundle changed into eliminated mechanically via way of means of apt. Also, there has been a time while upgrading kernel changed into additionally a large deal. It changed into as much as sysadmins to decide if the hooked up kernel model could be upgraded or now no longer. Ubuntu and different distributions have made it barely higher in current times. So, does which means that as a computer Linux user, you may ditch apt-get improve and depend upon dist-upgrade all of the time? I even have a higher notion here.
Use the apt command instead
No, seriously. apt-get is a legacy, low-stage command that could do many matters. It is appropriate for use in scripts via way of means of different equipment or sysadmins. The apt command is a simplified model and is aimed towards regular, informal customers. It does matters a chunk higher and less complicated than apt-get.
sudo apt update && sudo apt upgrade
Unlike apt-get upgrade, the apt upgrade can install new packages and hence it can upgrade the Linux kernel version.
There is also apt full-upgrade which is equivalent to dist-upgrade.
Was it clear?
I would advise reading a bit more on the apt and apt-get commands. Here are a few articles to help you out:
- Using apt command
- Using apt-get command
- Difference between apt and apt-get commands
I hope I was able to make things clear and you have a better understanding of the difference between apt-get upgrade and dist-upgrade.
But if that’s not the case and you still have some questions, please let me know in the comment section.