apt System Maintenance Script

A helper script to keep the apt-get environment clean.

There is nothing clever about this script, it is really just a helper script which saves typing.

The APT system used by Debian and it’s derivatives (Ubuntu, Raspbian, etc.) mainly revolves around updating the package lists and upgrading installed packages. i.e.

sudo apt-get update

sudo apt-get upgrade

Over time the system can get polluted with obsolete packages in the cache and installed packages which are no longer required. The helper script discussed here addresses these subjects.

Script Design

The script runs a number of apt-get commands

apt-get upgrade

The first command run is upgrade which upgrades installed packages if a newer version is available.

apt-get autoclean

This removes packages from the cache which can no longer be downloaded.

apt-get check

This updates the package cache and checks for broken dependencies.

apt-get autoremove

This removes packages which were automatically installed to satisfy a dependency for another package being installed and are no longer required.

And that is it!

Installing the agmaint package

The APT maintenance helper script package is called agmaint.
To prevent bitrot of this blog, please follow the installation instructions for your distribution at the project wiki:-
https://github.com/m-grant-prg/agmaint/wiki

Running the script

The script should be run regularly, I run it every day but less frequently is OK. You have to run the script with elevated privileges:-

sudo agmaint.sh

Authoritative sources

The authoritative source for this project is held on GitHub at:-

The code repository:- https://github.com/m-grant-prg/agmaint

The wiki:- https://github.com/m-grant-prg/agmaint/wiki

To view or raise issues please visit:- https://github.com/m-grant-prg/agmaint/issues

My Projects