Skip to content

pacman -Q, but without default/base packages?

I would like to have a list of all packages I have installed, I tried to use pacman -Q but that's all packages on the system, I want ones that aren't installed by "default" (by pacstrap /mnt base).

1 points5 comments
Open on Reddit
About this post
Posted
Archived
Score
1 · 100% up
Kind
Text
ID
7d2b09

Author

62
posts
170
comments
24
media
View profile

5 comments

I made a bunch of experiments to try to answer this, and came up with this end result here:

comm -13 <(pacman -Sgq base | sort -u) <(pacman -Qetq | sort) | pacman -Qi - | perl -n00E '($n) = /^Name *: (.*)/m; ($d) = /^Description *: (.*)/m; printf "%-20s | %s\n", $n, $d'

This command line compares a list of explicitly installed packages with the ones out of the base group, then prints names and descriptions of those.

It does not display any packages that were installed as dependencies.

For just a list of package names, only run the first part:

comm -13 <(pacman -Sgq base | sort -u) <(pacman -Qetq | sort)

If you want to list all packages, including the ones that are installed as a dependency, things get more complicated and look like this:

comm -13 <(pacman -Sgq base | xargs -L1 pactree -l 2> /dev/null | sort -u) <(pacman -Qq | sort)

Here are the previous command lines with line-breaks:

comm -13 \
    <( pacman -Sgq base | sort -u ) \
    <( pacman -Qetq | sort )

# -------------------------------------

comm -13 \
    <( pacman -Sgq base | sort -u ) \
    <( pacman -Qetq | sort ) | 
pacman -Qi - | 
perl -n00E '
    ($n) = /^Name *: (.*)/m;
    ($d) = /^Description *: (.*)/m;
    printf "%-20s | %s\n", $n, $d
'

# -------------------------------------

comm -13 \
    <( pacman -Sgq base | 
       xargs -L1 pactree -l 2> /dev/null | 
       sort -u ) \
    <( pacman -Qq | sort )
10 points

See pacman/Tips and tricks, specifically...

list explicitly installed packages not in the base or base-devel groups:

$ comm -23 <(pacman -Qeq | sort) <(pacman -Qgq base base-devel | sort)

or list all installed packages unrequired by other packages, and which are not in the base or base-devel groups:

$ comm -23 <(pacman -Qqt | sort) <(pacman -Sqg base base-devel | sort)
3 points

pacman -Qs | grep -v \(base\) | grep ^local
But it doesn't filter dependencies

2 points

All explicitly installed packages not in base nor base-devel with size and description ->

(you need to install "expac" for this)

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.