Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

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?

share|improve this question

3 Answers 3

up vote 6 down vote accepted

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."
  else
    sudo pacman -Rs $(pacman -Qdtq)
  fi
}
share|improve this answer
1  
I don't trust scripts when it comes to deleting ;P Anyway, thanks. –  Xirdus Dec 4 '12 at 22:10
2  
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.

share|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.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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