RHELでインストール済みのコマンドが含まれるパッケージについて調査する!(rpm)

RHELでインストール済みのコマンドが含まれるパッケージについて調査する方法をまとめます。

コマンドからパッケージを特定する!(rpm -qf)

「rpm -qf」コマンドを使用して、コマンドのフルパスを指定して、インストールで使用したパッケージを特定します。

$ rpm -qf /bin/dnf
dnf-4.4.2-11.el8.noarch

パッケージの詳細情報を表示する!(rpm -qi)

「rpm -qi」コマンドを使用すると、パッケージの詳細情報を表示することができます。

$ rpm -qi dnf-4.4.2-11.el8.noarch
Name        : dnf
Version     : 4.4.2
Release     : 11.el8
Architecture: noarch
Install Date: Thu 24 Mar 2022 03:06:11 PM JST
Group       : Unspecified
Size        : 2085187
License     : GPLv2+ and GPLv2 and GPL
Signature   : RSA/SHA256, Thu 11 Mar 2021 12:51:25 AM JST, Key ID 199e2f91fd431d51
Source RPM  : dnf-4.4.2-11.el8.src.rpm
Build Date  : Tue 09 Mar 2021 12:43:15 AM JST
Build Host  : s390-060.build.eng.bos.redhat.com
Relocations : (not relocatable)
Packager    : Red Hat, Inc. <http://bugzilla.redhat.com/bugzilla>
Vendor      : Red Hat, Inc.
URL         : https://github.com/rpm-software-management/dnf
Summary     : Package manager
Description :
Utility that allows users to manage packages on their systems.
It supports RPMs, modules and comps groups & environments.

パッケージに含まれるファイルを表示する!(rpm -qf)

「rpm -ql」コマンドを使用すると、パッケージに含まれるファイルを表示できます。関連するコマンドなど調べることができます。

$ rpm -ql dnf-4.4.2-11.el8.noarch
/usr/bin/dnf
/usr/lib/systemd/system/dnf-makecache.service
/usr/lib/systemd/system/dnf-makecache.timer
/usr/share/bash-completion
/usr/share/bash-completion/completions
/usr/share/bash-completion/completions/dnf
/usr/share/locale/ar/LC_MESSAGES/dnf.mo
/usr/share/locale/bg/LC_MESSAGES/dnf.mo
/usr/share/locale/bn_IN/LC_MESSAGES/dnf.mo
/usr/share/locale/ca/LC_MESSAGES/dnf.mo
/usr/share/locale/cs/LC_MESSAGES/dnf.mo
/usr/share/locale/da/LC_MESSAGES/dnf.mo
/usr/share/locale/de/LC_MESSAGES/dnf.mo
/usr/share/locale/el/LC_MESSAGES/dnf.mo
/usr/share/locale/en_GB/LC_MESSAGES/dnf.mo
/usr/share/locale/eo/LC_MESSAGES/dnf.mo
/usr/share/locale/es/LC_MESSAGES/dnf.mo
/usr/share/locale/eu/LC_MESSAGES/dnf.mo
/usr/share/locale/fa/LC_MESSAGES/dnf.mo
/usr/share/locale/fi/LC_MESSAGES/dnf.mo
/usr/share/locale/fil/LC_MESSAGES/dnf.mo
/usr/share/locale/fr/LC_MESSAGES/dnf.mo
/usr/share/locale/fur/LC_MESSAGES/dnf.mo
/usr/share/locale/gd/LC_MESSAGES/dnf.mo
/usr/share/locale/gu/LC_MESSAGES/dnf.mo
/usr/share/locale/he/LC_MESSAGES/dnf.mo
/usr/share/locale/hi/LC_MESSAGES/dnf.mo
/usr/share/locale/hr/LC_MESSAGES/dnf.mo
/usr/share/locale/hu/LC_MESSAGES/dnf.mo
/usr/share/locale/id/LC_MESSAGES/dnf.mo
/usr/share/locale/it/LC_MESSAGES/dnf.mo
/usr/share/locale/ja/LC_MESSAGES/dnf.mo
/usr/share/locale/ka/LC_MESSAGES/dnf.mo
/usr/share/locale/kk/LC_MESSAGES/dnf.mo
/usr/share/locale/ko/LC_MESSAGES/dnf.mo
/usr/share/locale/lt/LC_MESSAGES/dnf.mo
/usr/share/locale/ml/LC_MESSAGES/dnf.mo
/usr/share/locale/mr/LC_MESSAGES/dnf.mo
/usr/share/locale/ms/LC_MESSAGES/dnf.mo
/usr/share/locale/nb/LC_MESSAGES/dnf.mo
/usr/share/locale/nl/LC_MESSAGES/dnf.mo
/usr/share/locale/or/LC_MESSAGES/dnf.mo
/usr/share/locale/pa/LC_MESSAGES/dnf.mo
/usr/share/locale/pl/LC_MESSAGES/dnf.mo
/usr/share/locale/pt/LC_MESSAGES/dnf.mo
/usr/share/locale/pt_BR/LC_MESSAGES/dnf.mo
/usr/share/locale/ru/LC_MESSAGES/dnf.mo
/usr/share/locale/sk/LC_MESSAGES/dnf.mo
/usr/share/locale/sq/LC_MESSAGES/dnf.mo
/usr/share/locale/sr/LC_MESSAGES/dnf.mo
/usr/share/locale/sr@latin/LC_MESSAGES/dnf.mo
/usr/share/locale/sv/LC_MESSAGES/dnf.mo
/usr/share/locale/th/LC_MESSAGES/dnf.mo
/usr/share/locale/tr/LC_MESSAGES/dnf.mo
/usr/share/locale/uk/LC_MESSAGES/dnf.mo
/usr/share/locale/ur/LC_MESSAGES/dnf.mo
/usr/share/locale/vi/LC_MESSAGES/dnf.mo
/usr/share/locale/zh_CN/LC_MESSAGES/dnf.mo
/usr/share/locale/zh_TW/LC_MESSAGES/dnf.mo
/usr/share/man/man5/dnf-transaction-json.5.gz
/usr/share/man/man7/dnf.modularity.7.gz
/usr/share/man/man8/dnf.8.gz
/usr/share/man/man8/yum2dnf.8.gz
/var/cache/dnf

おわりに

インストール済みのコマンドに関しては、rpmコマンドを使用して、パッケージ関連の情報を調べることができます。

参考情報

関連記事

関連書籍(Amazon)

N/A