Detects and interactively deactivates duplicate Apt source entries and
deletes sources list files without valid enabled source entries in
/etc/sources.list and /etc/sources.list.d/*.list.
-
Python 3.2+ (or Python 2.7+ if you really can't use Python 3)
-
The
aptsourcesmodule. In Debian-based distribution you can find it in thepython3-aptpackage (orpython-aptif you only have Python 2).If you don't have it yet you can install it with:
sudo apt-get install python3-apt
You can download a pre-bundled ZIP file executable by your Python interpreter:
Or you can download the source code and run it in Python albeit without translations.
-
From a ZIP bundle:
sudo python3 -OEs aptsources-cleanup.zipI advise the use of the above interpreter options
-OEsto avoid potential issues with your Python environment but they aren't strictly necessary. -
From source code:
sudo ./aptsources-cleanup
For a (slightly more) detailed description and individual command-line options see the output of
python3 -OEs aptsources-cleanup.zip --help
or
./aptsources-cleanup --help
depending on the deployment type.