Nice, useful little pacman fu
It took me a bit to figure this out, but this is a short little command to remove unneeded packages:
sudo pacman -Rns $(pacman -Qdt | awk '{printf("%s ",$1)}')
My apologies if it's obvious, but I thought it might be of help.
EDIT: as /u/WishCow pointed out, this does the same thing, with less typing
sudo pacman -Rns $(pacman -Qdtq)
Alternatively, if you aren't a fan of interpolation
pacman -Qdtq | sudo pacman -Rns
Edited 11 Mar 2014. We only hold this version.
About this post
- Posted
- Archived
- Edited
- Score
- 11 · 100% up
- Kind
- Text
- ID
- 205nfp
10 comments
pacman -Qdtq | pacman -Rs -
I think this does the same, and also removes the dependencies of unused packages.
Why the dash at the end?
Read targets from stdin.
Almost. The difference between
-Rsand-Rsnis,-Rsnalso removes/etcfiles.Interesting, the
-qoption isn't documented (at least not in the pop-up documentation).This is bikeshedding, but awk is sort of overkill:
I hate leftover packages, so I always
The "c" being
That seems redundant, because
-Qtdqwill only list packages not required by any other package.Nice, I'll be sure to give this a try once I'm back home!
Here's more: https://wiki.archlinux.org/index.php/Pacman_Rosetta