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”

Asked By: pandita

||

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.

Answered By: Fox

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

Answered By: Nadir

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
Answered By: Nadir
Categories: Answers Tags: ,
Answers are sorted by their score. The answer accepted by the question owner as the best is marked with
at the top-right corner.