pacman – get list of packages installed by user
How can I get a list of packages that were explicitly installed by a user?
I’m aware of:
pacman -Qe
pacman -Qi
But those seem to include the default packages for my distribution (e.g. sudo). I want to list only the packages that were installed by a user using e.g. “pacman -Syu newpackage”
Arch Linux doesn’t really have a set of default packages, though if you install from the guide you likely installed the base
package group, and possibly base-devel
. You can use comm
to filter these (I’m assuming bash
here):
comm -23 <(pacman -Qqett | sort) <(pacman -Qqg base-devel | sort | uniq)
You can use Qqe
instead of Qqett
if you want to include explicitly-installed packages that are also dependencies of some other package.
simpler solution, that keeps historical order:
grep -i installed /var/log/pacman.log
however you will have upgrades in this list, and it will not contain explicitly installed only
alternate option that will include AUR
# packages installés explicitements - la base - les foreign
pacman -Qqe | grep -vx "$(pacman -Qqg base-devel)" | grep -vx "$(pacman -Qqm)" > main.lst
## Create local.lst of local (includes AUR) packages installed
# que les foreign
pacman -Qqm > aurandlocal.lst