this doesn’t actually do the same thing as the previous comment running autoremove afterwards does; the former will remove things which were rendered removable by the upgrade while the latter will only remove things which were already autoremovable prior the upgrade.
Even better:
sudo apt --update upgrade -ysudo apt --update upgrade -y && sudo apt autoremove -ysudo apt --update --autoremove upgrade -ynote
this doesn’t actually do the same thing as the previous comment running autoremove afterwards does; the former will remove things which were rendered removable by the upgrade while the latter will only remove things which were already autoremovable prior the upgrade.