Last active
December 29, 2024 16:25
-
-
Save brandleesee/79ccf8f8bdffaebbd7d251ed8ae173f6 to your computer and use it in GitHub Desktop.
Ubuntu Update Script
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
clear && sudo apt clean && sudo apt update -y && sudo dpkg --configure -a -y && sudo apt install -f -y && sudo apt dist-upgrade -y && sudo apt autoremove --purge -y |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Introduction
A short and functional maintainance script to update and upgrade the packages of an Ubuntu and Debian operating system.
Usage
Either add it as an alias or copy/paste the string of commangs in the terminal and run.
Remove any commands that are not desired including the subsequent
&&
.List of Commands
clear
removes any text occupying the terminal window or tty. Used to declutter the screen in preparation for the updates.update
refreshes the repositories from where packages are pulled to upgrade the system.dist-upgrade
is the command that updates all the packages and installs any required dependencies that allow those updated packages to run as intended.autoremove
removes packages, including dependencies, that are no longer required by the system.clean
deletes packages left in the system for backups.Fail-Safe Mechanisms
Using
&&
is my preferred method for a fail-safe mechanism where if the command being executed before that produces an error, the script stops its progress. The rationale behind this is to avoid further endagering the workstation.-f
is used as a secondary fail-safe mechanism should&&
not quit the script because of packages incorrectly installed. It repairs errors and ameliorates package dependencies produced by the `dist-upgrade' command.Further Reading
https://wiki.debian.org/AptCLI
https://manpages.ubuntu.com/manpages/focal/man8/apt-get.8.html
https://debian-handbook.info/browse/stable/sect.apt-get.html
https://support.system76.com/articles/package-manager-pop/