How to upgrade a Debian-based Linux distribution–let me count the ways. There’s an apt-get upgrade, apt-get dist-upgrade, and do-release-upgrade. Say what? Why are there three different paths to upgrading an operating system? Truth be told, each of those commands does different things. Confused?

Let me explain.

SEE: Choosing your Windows 7 exit strategy: Four options (Tech Pro Research)

apt-get upgrade vs. apt-get dist-upgrade

Let’s first look at the difference between apt-get upgrade and apt-get dist-upgrade (as that is where much of the confusion lies). When you run apt-get upgrade, it only upgrades that which has a new release available to the platform, as defined in /etc/apt/sources.list or in /etc/apt/sources.list.d/.

However, when you run apt-get dist-upgrade, it will intelligently install or remove packages as needed, in order to complete the upgrade. Apt-get dist-upgrade has a smart conflict resolution system, so it will attempt to upgrade the most important packages, at the expense of those deemed less important.

Apt-get upgrade does not remove packages, it only upgrades. Can you use sudo apt-get dist-upgrade as your regular upgrade tool? Certainly. Just remember, it will delete software–if it is required to complete the process.

do-release-upgrade

The do-release-upgrade command, on the other hand, is responsible for upgrading from one release to another. So if you want to upgrade from Ubuntu 18.10 to 19.04, you use do-release-upgrade.

However, in order to use this command, the system must first be fully upgraded. To do that, you should first run sudo apt-get upgrade, followed by sudo apt-get dist-upgrade. When those two complete, you can then run sudo do-release-upgrade and wait for the magic to complete.

The difference between these commands is important. In fact, you might want to read up on the apt-get and do-release-upgrade man pages to find out more. To do that, issue the commands man apt-get and man do-release-upgrade. Enjoy the read.

Subscribe to the Developer Insider Newsletter

From the hottest programming languages to commentary on the Linux OS, get the developer and open source news and tips you need to know. Delivered Tuesdays and Thursdays

Subscribe to the Developer Insider Newsletter

From the hottest programming languages to commentary on the Linux OS, get the developer and open source news and tips you need to know. Delivered Tuesdays and Thursdays