3

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"

4

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 -g 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.

  • This worked well! So just to clarify, pacman also doesn't keep track of who installs something? – pandita Dec 10 '17 at 9:50
  • 1
    @pandita On my system, attempts to install software as non-root yields error: you cannot perform this operation unless you are root. If you use sudo, you become root. So as far as pacman can tell, the only user who can install a package is root and there's no need to track that – Fox Dec 10 '17 at 10:03
  • Try comm -23 <(pacman -Qqett | sort | uniq) <(pacman -Qqg base -g base-devel | sort | uniq) So they are both in the same sorted order – Ryan Ward Jun 4 '18 at 13:27
  • This has a problem with circular dependencies. For example, jupyter is required by X which is required by Y .... which is required by jupyter. So although I explicitly installed it and it won't be installed as a dependency of any listed package, jupyter itself is not listed, which makes the output of this command unable to ensure reproducibility. – memeplex Feb 21 at 9:06

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.