These are tested on Ubuntu 20.04 but probably work on other Debian distributions

Full update (no questions, yes to all)

apt-get update -y && apt-get upgrade -y && apt-get dist-upgrade -y

Removes packages that are no longer needed:

apt-get autoremove