Pacman autoremove unused packages

Package managers can detect which packages were manually installed (at user or script explicit request) and which were implicitly installed as a prerequisite. When uninstalling the manually installed package, the prerequisite packages are often not auto-uninstalled. To recover the possibly significant amount of disk space from these now unused packages, an autoremove command is useful. For systems using “apt”, the command is:

apt autoremove

Pacman shows the auto-installed prerequisites with:

pacman -Qdtq

This can be piped into the Pacman remove command upon verifying the packages above are indeed OK to remove:

pacman -Qdtq | pacman -Rs -