Linux - Package management

mail

How to handle RPM repository keys ?

list installed keys

rpm -qa gpg-pubkey
gpg-pubkey-2f86d6a1-5cf7cefb
gpg-pubkey-d4082792-5b32db75
gpg-pubkey-3ad1f33f-5a4cef4c
gpg-pubkey-fd431d51-4ae0493b

get full details about a key

rpm -qi gpg-pubkey-2f86d6a1-5cf7cefb
Name        : gpg-pubkey
Version     : 2f86d6a1
Release     : 5cf7cefb
Architecture: (none)
Install Date: Wed Oct  1 15:26:15 2025
Group       : Public Keys
Size        : 0
License     : pubkey
Signature   : (none)
Source RPM  : (none)
Build Date  : Wed Jun  5 16:17:31 2019
Build Host  : localhost
Relocations : (not relocatable)
Packager    : Fedora EPEL (8) <epel@fedoraproject.org>
Summary     : gpg(Fedora EPEL (8) <epel@fedoraproject.org>)
Description :
-----BEGIN PGP PUBLIC KEY BLOCK-----
Version: rpm-4.14.3 (NSS-3)

mQINBFz3zvsBEADJOIIWllGudxnpvJnkxQz2CtoWI7godVnoclrdl83kVjqSQp+2

zKK4OjJ644NDcWCHa36znwVmkz3ixL8Q0auR15Oqq2BjR/fyog==
=84m8
-----END PGP PUBLIC KEY BLOCK-----

get metadata about all keys

method 1 :

rpm -qi gpg-pubkey | grep -E 'Name|Version |Packager|^$'the ^$ only serves to extract empty lines and make output more readable
Name        : gpg-pubkey
Version     : fd431d51
Packager    : Red Hat, Inc. (release key 2) <security@redhat.com>

Name        : gpg-pubkey
Version     : d4082792
Packager    : Red Hat, Inc. (auxiliary key) <security@redhat.com>

Name        : gpg-pubkey
Version     : 2f86d6a1
Packager    : Fedora EPEL (8) <epel@fedoraproject.org>

Name        : gpg-pubkey
Version     : 3ad1f33f
Packager    : Cyberwatch SAS (RPM Signing Key) <support-it@cyberwatch.fr>

method 2 (see example 3 here) :

gpg-pubkey-fd431d51-4ae0493b    gpg(Red Hat, Inc. (release key 2) <security@redhat.com>)
gpg-pubkey-d4082792-5b32db75    gpg(Red Hat, Inc. (auxiliary key) <security@redhat.com>)
gpg-pubkey-2f86d6a1-5cf7cefb    gpg(Fedora EPEL (8) <epel@fedoraproject.org>)
gpg-pubkey-3ad1f33f-5a4cef4c    gpg(Cyberwatch SAS (RPM Signing Key) <support-it@cyberwatch.fr>)
^^^^^^^^^^ ^^^^^^^^ ^^^^^^^^	^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   name    version  release                              summary
rpm -q gpg-pubkey --qf '%{summary}\n'ok with upper/lower case
gpg(Red Hat, Inc. (release key 2) <security@redhat.com>)
gpg(Red Hat, Inc. (auxiliary key) <security@redhat.com>)
gpg(Fedora EPEL (8) <epel@fedoraproject.org>)
gpg(Cyberwatch SAS (RPM Signing Key) <support-it@cyberwatch.fr>)
mail

How to list packages in the order they were installed ?

Usage

zgrep -ih 'status installed' /var/log/dpkg.log* | sort | uniq | less

Example

install + upgrade history of nano :

zgrep -ihE ' installed|upgrade' /var/log/dpkg.log* | sort | uniq | grep nano
mail

How to disable installation of recommends and suggests packages ?

echo -e 'APT::Install-Recommends "0";\nAPT::Install-Suggests "0";' >> /etc/apt/apt.conf.d/60recommends
mail

How to find which package a specific file belongs to ?

  1. Get details on the file itself : a binary may be a symlink to another binary.
    which rename
    rename: /usr/bin/rename.ul /usr/bin/rename /usr/bin/X11/rename.ul /usr/bin/X11/rename /usr/share/man/man2/rename.2.gz /usr/share/man/man1/rename.1.gz
  2. Ask the package management tools :
    dpkg-query -S /usr/bin/rename.ul
    util-linux: /usr/bin/rename.ul
Consider having a look at the Debian packages page also.
mail

How to list files of an uninstalled package ?

  1. Search your package name on the Debian packages page
  2. Select it from the results
  3. Scroll to the bottom of the page
  4. Click on the files list hyperlink matching your architecture