Autoremove will do just this.
Apt upgrade vs full-upgrade vs dist-upgrade. With the new wrapper apt dist-upgrade is called full-upgrade which better reflects what it does. Update being a separate command makes sense IMO but I guess there could be a flag --update which implies update when using the other commands. Apt full-upgrade works very similarly to apt upgrade except it also has the ability to remove packages from the system if its necessary in order to complete an upgrade.
This is why you first want to update. Apt-get upgrade is low-risk and you can pretty much do it without paying attention whereas apt-get dist-upgrade might occasionally remove a program that you rely on especially if you havent taken care to mark all the packages you absolutely need as manually installed. Dist-upgradefull-upgrade will remove packages that were automatically installed installed as dependants of manually selected packages as needed to satisfy package upgrade dependency conflicts.
Thus the apt-get dist-upgrade. In our previous guide we fleshed out the differences between apt update and apt upgrade. The full-upgrade action and dist-upgrade which is a synonym can do this too but it also can remove packages including packages marked as having been manually installed.
Neither upgrade nor dist-upgradefull-upgrade will remove automatically installed packages dependencies that are no longer needed after the upgrade. In this tutorial we look at apt-get upgrade and apt-get dist-upgrade commands and seek to understand the difference and when each is used. Apt upgrade will upgrade currently-installed packages and install new packages pulled in by updated dependencies.
Apt-get dist-upgrade in addition to performing the function of apt-get upgrade also intelligently handles changing dependencies with new versions of packages and will attempt to upgrade the most important packages at the expense of less important ones if necessary. What is the difference between apt update and apt upgrade. According to the man pages the command apt-get upgrade for older DebianUbuntu releases or apt upgrade for newer releases.
After updating the lists the package manager knows about available updates for the software you have installed. When running apt-get dist-upgrade on a PVE host when will this affect running guestsHelpful. It also removes old packages if needed for the upgrade.