This is the only command I’ll use to upgrade or update the OS on my Ubuntu instances, any version. This doesn’t upgrade to the next version of ubuntu, only to the latest of the version you’re running now.
apt-get clean;apt-get update;apt-get dist-upgrade;apt-get autoremove
Here’s the breakdown:
Erase downloaded archive files, cleans up old data and forces re-downloading package info.
apt-get clean;
Update the list of packages Ubuntu “knows” about.
apt-get update;
Run the actual upgrade.
apt-get dist-upgrade;
Remove packages you don’t need anymore, freeing space.
apt-get autoremove;