Running Apt Updates with Python

Saving the file below as a .py file and then run using Python3. It will run the following:

  • sudo apt update
  • sudo apt upgrade -y
  • sudo apt full-upgrade -y
  • sudo apt dist-upgrade -y
  • sudo apt autoremove -y
  • sudo apt clean -y
  • sudo apt purge -y
import subprocess

Run 'sudo apt update'['sudo', 'apt', 'update'])

Run 'sudo apt upgrade -y'['sudo', 'apt', 'upgrade', '-y'])

Run 'sudo apt full-upgrade -y'['sudo', 'apt', 'full-upgrade', '-y'])

Run 'sudo apt dist-upgrade -y'['sudo', 'apt', 'dist-upgrade', '-y'])

Run 'sudo apt autoremove -y'['sudo', 'apt', 'autoremove', '-y'])

Run 'sudo apt clean -y'['sudo', 'apt', 'clean', '-y'])

Run 'sudo apt purge -y'['sudo', 'apt', 'purge', '-y'])