Published: 2011-06-07
Updated: 2011-06-07

2022 UPDATE: This is many years obsolete, since pacman -Qt shows leaf packages, pacman -Qtt ignores optional dependencies, and pacman -Qi <package> shows "Required By" and "Optional For".

In general, I like to keep my computers squeaky clean. When it comes to packages installed in an ubuntu or debian system, I like to use debfoster. These days I use Arch Linux, so I wrote something somewhat similar for it. One uses it like so:

[plopez@plopez-8440p pacreview]$ sudo ./pacreview 

WARNING - needs to be run as root, and has no 'undo'
Building reverse Optional Deps database...

Remove unrequired package ack? [k,r,i,l,x,#,q,h=help]: keep

Remove unrequired package alsa-utils? [k,r,i,l,x,#,q,h=help]: help

k = keep
r = remove
i = show package info
l = show package file list
x = show package executables
# = (number) show info for package in optdep list
q = quit
h = this help

Remove unrequired package alsa-utils? [k,r,i,l,x,#,q,h=help]: 

When run in your terminal, package names are bold so they stand out, and even though it looks like I typed "help" above, I just tapped the "h" key.

This is a perl script, and it uses the perl module Term::ReadKey, you'll need to install the Arch package "perl-term-readkey".

Without further ado, the script: