However, it is along the lines that automatically removing dependencies is risky business. So if you want to do it yourself then this tool answers an important question: What.
Focus on the results that you are trying to achieve: reducing the risk of automatically removing dependencies.
List the dependencies and reverse dependencies for a package with apt-cache depends <package-name>
and apt-cache rdepends <package-name>
. These are basic commands which can be tailored to different specific situations as follows.
The package names following apt-cache can be either a single package name or a list of multiple package names.
Pipe to the results of apt-cache
commands to less
with | less
to return only the first part of the results if the results would be too long to be easy to read.
Install deborphan with sudo apt install deborphan
and run deborphan
to show a list of packages orphaned after uninstalling some packages. These orphaned packages are no longer necessary except if you are still using any of the packages that you just uninstalled. Unfortunately deborphan
reports manually installed .deb packages that weren't installed via your normal software sources as orphaned packages too, so deborphan
should be used together with apt-cache
to make sure that you don't uninstall any packages that you still need even though deborphan
reports them as orphaned packages.
Using a smart combination of all these commands will save a lot of time compared to reading a long list all packages, their sizes, their dependencies and the sizes thereof, by focusing only on the results that you need. Using these commands it is possible to clean up the list of installed packages after upgrading Ubuntu to a newer release in just a few minutes. For this particular task I also like to use Synaptic Package Manager because of its user-friendly graphical interface and powerful package filtering features.