Skip to content

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.

11 points10 comments
Open on Reddit
About this post
Posted
Archived
Edited
Score
11 · 100% up
Kind
Text
ID
205nfp

Author

12
posts
58
comments
10
media
View profile

10 comments

pacman -Qdtq | pacman -Rs -

I think this does the same, and also removes the dependencies of unused packages.

6 points

Almost. The difference between -Rs and -Rsn is, -Rsn also removes /etc files.

Interesting, the -q option isn't documented (at least not in the pop-up documentation).

2 points

I hate leftover packages, so I always

pacman -Rcsn $(pacman -Qqtd)

The "c" being

-c, --cascade        remove packages and all packages that depend on them
1 points

That seems redundant, because -Qtdq will only list packages not required by any other package.

1 points

Nice, I'll be sure to give this a try once I'm back home!

1 points

Keyboard shortcuts

Move and act

jork
Next / previous post or comment
Enteroro
Open the post
f
Open the media viewer
s
Save
h
Hide (the toast has Undo)
Tab
Right after an action: the toast's Undo
x
Collapse the comment
v
Next layout: cards, compact, grid

Go to

/
Search
gthenh
Home
gthena
All
gthens
Subreddits
gthenl
Library
?
This list
Esc
Close a menu or this list

In the viewer

←or→
Previous / next file
↑or↓
Previous / next post
korj
Previous / next post
Space
Play / pause
m
Mute
z
Zoom
s
Save
o
Open the post (on its own page: back to it)
Esc
Close

Keys do nothing while you type in a box.