I'm using Arch Linux, with its Pacman package manager. I want to keep my system as clean as possible, and that includes not having any unused packages installed. But, because of dependencies, it's not a trivial task to have zero of such, at least with my level of knowledge. Is there any tool available, console or GUI, that will show me all installed packages that nothing depends on?


From the Arch Wiki:

To list all packages no longer required as dependencies (orphans):
$ pacman -Qdt

Or, to recursively remove orphans:

orphans() {
  if [[ ! -n $(pacman -Qdt) ]]; then
    echo "No orphans to remove."
    sudo pacman -Rs $(pacman -Qdtq)
| improve this answer | |
  • 2
    I don't trust scripts when it comes to deleting ;P Anyway, thanks. – Xirdus Dec 4 '12 at 22:10
  • 3
    Fair enough: pacman will print a list of the packages for deletion, seeking your confirmation; so it is not entirely Russian Roulette... – jasonwryan Dec 4 '12 at 22:11

pacman -Qt prints packages whose doesn't need on system (maybe you need it). I hope I didn't misunderstand you.

| improve this answer | |
  • 3
    The -t switch displays packages that are not required by another package, but this will obviously include stand-alone packages; you should combine it with the -d switch for a better picture of "orphaned" packages--which is what I assume the OP means by "unused packages." – jasonwryan Dec 4 '12 at 21:49
  • I know but it wasn't unequivocal for me what Xirdus wants. – uzsolt Dec 5 '12 at 9:37

You usually want to see a list of end-user programs you have installed:

pacman -Qte

where t lists the end nodes of the dependency graph (the packets not required by other installed packets) and e filters out only explicitly installed packages.

If you always forget what these programs are for (like I do), try:

pacman -Qtei | grep -P "Name|Description"

After uninstalling, use

pacman -Rs $(pacman -Qqtd)

To remove all orphan packages

Last idea taken from Pacman Tips.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.