Debian keeping packages current

I use the following command to keep my packages up to date and clean

sudo apt-get upgrade -y && sudo apt-get update -y && sudo apt-get autoremove -y && sudo apt-get autoclean -y


  • upgrade: Some people reverse the order as they want to update their packages prior to upgrading, I do not
  • update: Updates your current packages that are installed as of now
  • autoremove: This should remove unused packages, but autoclean after it does a better job in my experience
  • autoclean: I run the clean at the end to cleanup the mess I made

Additional command that I need to run from time to time

sudo apt-get update --fix-missing : Fixes the package url references which becomes a problem when new versions are released usually say 18.04 to 19.04 for Ubuntu.

If you want to run this everyday (I do not recommend that), add the command as a cronjob by calling out sudo crontab -e and added the commands without sudo and pipe to a log the stdout so you can determine when things mess up.

Cronjob to run every hour

0 * * * * <your command or script here>