YUM & RPM - cheat sheet

By kimot, 3 February, 2025

yum check                                                   - check for problems in rpmdb

yum check-update                                      - check for installed packages updates

yum help                                                     - shows commands and options

yum list                                                       - list package names - [available|installed|extras|updates|obsoletes|all|recent] [pkgspec] 
yum list available
yum list installed 
yum list installed 'yum*'

yum info 'package_name'                          - display information about package

rpm -qi 'package_name'                            - detailed information about installed package

yum provides                                              - show packages that provide given file
yum provides '/QOpenSys/usr/bin/find'

yum search 'package_name'                      - search package name and description for string

yum deplist                                                 - show package dependencies

yum downgrade                                        - downgrade package to earlier version

yum erase                                                   - erase package (dependencies) from system

yum install                                                  - install package from repository

yum reinstall                                               - reinstall current version of package

yum clean                                                    - to clean auxiliary files - [packages|metadata|dbcache|all]

yum makechache                                        - to download metadata from repositories

yum history                                                 - shows yum transactions
yum history list                                              - shows table of transactions
yum history list all                                         - to show table with all yum transactions
yum history summary
yum history info 'package_name'
yum history info 'transaction_id'
yum history undo 'transaction_id'                 - attempt to 'undo' what the specified transaction did
yum history redo 'transaction_id'                  - attempt to 'redo' what the specified transaction did
yum history new                                            - creates a new yum history db, saving the old one

rpm -qa --last |head -10                              - will show 10 latest installed packages

needs-restarting                                           - finds processes that have been updated and need to restart

repoquery -a --installed                              - to list installed packages

repoquery -l 'package_name'                     - to list all files in package

repoquery -f '/path/to/file'                        - which package contains specific file
rpm -qf '/path/to/file'                                 - which package contains specific file 
rpm -qf `which command_name`               - which package contains specific command_name

repoquery --location 'package_name'       - show URL address from which package was downloaded

repoquery --changelog 'package_name'   - show package changelog

rpm --querytags                                           - all tags usable in --queryformat option
rpm -qa --qf "%-25{NAME} %-22{VERSION} %-30{OS} %{ARCH}\n"   - querytags example 
rpm -qa --qf "%25{NAME} %10{VERSION} %12{RELEASE} %20{SIZE} %{INSTALLTIME:date}\n"

-bash-5.2$ rpm -qa --qf "%25{NAME} %10{VERSION} %12{RELEASE} %20{SIZE} %{INSTALLTIME:date}\n"
                  php-zip     8.2.27  11seiden8.2               599791 Mon Dec 30 11:58:17 2024
           itoolkit-utils      1.1.0            1                59475 Sat Jun 17 12:55:34 2023
                libgcc_s1     12.4.0            3               391262 Tue Oct 29 10:32:27 2024
          libopenssl1_0_0     1.0.2t            1              4478020 Fri Sep  3 16:27:54 2021
         python2-iniparse        0.4            2                72687 Wed Jul  8 16:00:28 2020
                libssh2-1     1.11.1            1              1768361 Mon Dec 30 11:55:16 2024
            openssl-devel     3.0.12            2             10609399 Wed Feb 21 16:14:30 2024
          python39-ibm_db   2.0.5.15            1               786383 Mon Apr 29 13:41:04 2024
      update-alternatives     1.19.8            1               281531 Wed Oct 23 10:23:54 2024
           python2-pycurl     7.43.0            4               848118 Wed Jul  8 16:00:28 2020
                 libuuid1     2.35.1            3               279686 Tue Sep 14 22:55:55 2021
                 libzstd1      1.5.2            1              1031002 Tue Dec 10 15:46:13 2024
        service-commander      1.7.1            1               628568 Wed Aug 30 09:02:41 2023
  ca-certificates-mozilla  2022.2.58            1              1024700 Thu Oct 27 15:27:07 2022
                  python2     2.7.18            7            106714457 Tue Nov  7 08:55:36 2023