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.
Update the list of packages Ubuntu “knows” about.
Run the actual upgrade.
Remove packages you don’t need anymore, freeing space.