https://anadoxin.org/blog

Standard actions of Linux package managers

Sat, 25 February 2023 :: #linux

I keep forgetting the command line options for standard Linux package manager actions, so I've decided to write a blog post about it. I'm currently using Gentoo, ArchLinux and Fedora, so I'll include pacman, rpm and deb flavors (for completion).

Q: Locating the owner package of a specified file

Portage:

$ qfile /usr/bin/ls    # or 'equery b /usr/bin/ls'
sys-apps/coreutils: /usr/bin/ls

Pacman:

$ pacman -Qo /usr/bin/ls
/usr/bin/ls is owned by coreutils 9.1-3

dpkg:

$ dpkg -S lspci
pciutils: /usr/bin/lspci

rpm:

$ rpm -qf /usr/bin/ps
procps-ng-3.3.17-4.fc36.1.x86_64

Q: Listing the contents of selected package

Portage:

qlist coreutils       # or 'equery f coreutils'

Pacman:

$ pacman -Ql coreutils

dpkg:

$ dpkg -L coreutils

rpm:

$ rpm -ql procps-ng

Q: Dump information about a package

Portage:

$ emerge --search coreutils

or

$ vim `equery w coreutils`

Pacman:

$ pacman -Qi coreutils

dpkg:

$ dpkg -s coreutils

rpm:

$ rpm -qi coreutils

I'm not delusional enough to expect that I'll remember this, but at least now I'll have a one-stop place where I can quickly look this up.