Pacgraph is a tool that generates a graph of your Arch Linux system’s package dependencies. You can install it from the AUR:
paru -S pacgraph
It’s helped identify packages that I had no idea were installed. After identifying the ones you don’t need, you can remove them:
sudo pacman -R packages_to_remove
After you’ve removed a few packages, you can run use this one-liner to remove any orphaned packages. An orphan is a package that was installed as a dependency of something that you already removed.
sudo pacman -Rns $(pacman -Qtdq)
I wrote a script (because I wanted to add error handling) and called it remove_orphans.sh:
#!/bin/bash
orphans=$(pacman -Qtdq)
if [ -z "$orphans" ]
then
echo "No orphans to remove"
else
sudo pacman -Rns $orphans
fi
You can run pacgraph a second time after removing some packages, it will show other packages that it didn’t previously have room for on the screen. If you’ve ever installed a package group such as kde-applications, then you’ll know that it installs a whole lot of junk that you don’t want. You might have to run pacgraph a few times before you can locate everything that is unneeded.
I use this bash alias to quickly run it:
alias pg='pacgraph -f /tmp/pacgraph && feh /tmp/pacgraph.svg'
That can go in your ~/.bashrc or wherever else your aliases are stored.
Leave a Reply