Skip to content

Instantly share code, notes, and snippets.

@kevinadhiguna
Last active March 1, 2022 23:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kevinadhiguna/fed9705a604896b851d3c55e761dbecf to your computer and use it in GitHub Desktop.
Save kevinadhiguna/fed9705a604896b851d3c55e761dbecf to your computer and use it in GitHub Desktop.
Update script for Debian-based Linux distribution
# Update OS
# '-y' automatically choose 'Yes' on interactive mode (when being asked to whether install/remove a package)
# Updates the package lists that need upgrading, as well as new packages that have just come to the repositories
#sudo apt update -y
# Force update using IPv4 :
sudo apt -o Acquire::ForceIPv4=true -y
# List all upgradable packages
apt list --upgradable
#sudo apt upgrade -y
# Force upgrade in IPv4 :
#sudo apt -o Acquire::ForceIPv4=true upgrade -y
#-------------------
# WARNING
#------------------
#
# 'apt upgrade' is unsafe on rolling release distributions.
# using 'apt full-upgrade' instead
# use 'apt upgrade --force' to override
#
# Performs the function of upgrade but may also remove installed packages if that is required in order to resolve a package conflict
#sudo apt full-upgrade -y
# Force full-upgrade in IPv4 :
sudo apt -o Acquire::ForceIPv4=true full-upgrade -y
# Removes packages that were automatically installed to satisfy dependencies for some package and that are no longer needed
sudo apt autoremove -y
# Clears out the local repository of retrieved package files. This only removes package files that can no longer be downloaded, and are largely useless.
sudo apt autoclean
#------------
# References
#------------
#
# 1. https://askubuntu.com/a/222352
# 2. https://askubuntu.com/a/3169
#
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment