RPM

Querying


Command Description
rpm -q query all installed packages
rpm -q firefox query firefox installed
rpm -ql firefox query list of files in firefox package
rpm -qid firefox query package information including documentation files
rpm -qf /usr/bin/ab which package that owns ab
rpm -qdf /usr/bin/ab list document comes with package that owns ab
rpm -V package verify an installed package
rpm -Va verify all installed package
rpm -Vf /usr/bin/ab verify the package that owns ab
rpm -qa --qf "%-10{SIZE} %-30{NAME}\n" | sort -n | less sort all installed packages by size
rpm -qa --qf "%{n}-%{v}-%{r}.%{arch}\n"     :list architecture
rpm -qpR package     list package dependencies
rpm -qp --scripts package    list package pre and post scripts
rpm -qa --queryformat '%{SIZE}\n' | awk '{sum += $1} END {printf("Total size in packages = %4.1f GB\n", sum/1024**3)}'  total size of all rpms installed
rpm -q --changelog package package change log
rpm -q --provides package what the package provides
rpm -q --qf '[%{obsoletes}\n]' package show obsolete tags
rpm -K package.rpm verify package integrity
  1. rpm -qa: query all installed packages
  2. rpm -q firefox: query firefox installed
  3. rpm -ql firefox: query list of files in firefox package
  4. rpm -qpl name.rpm query list files in name.rpm
  5. rpm -qid firefox: query package information including documentation files
  6. rpm -qf /usr/bin/ab: which package that owns ab
  7. rpm -qdf /usr/bin/ab: list document comes with package that owns ab
  8. rpm -V package: verify a package
  9. rpm -Va: verify all installed package
  10. rpm -Vf /usr/bin/ab: verify the package that owns ab.
  11. rpm -qa --qf "%-10{SIZE} %-30{NAME}\n" | sort -n | less: sort all installed packages by size.
  12. rpm -qa --qf "%{n}-%{v}-%{r}.%{arch}\n"    :list architecture
  13. rpm -qpR package:    list package dependencies
  14. rpm --test -e package: list what requires this package
  15. rpm -qp --scripts package:   list package pre and post scripts
  16. rpm -q --changelog package: package change log
  17. rpm -qa --queryformat '%{SIZE}\n' | awk '{sum += $1} END {printf("Total size in packages = %4.1f GB\n", sum/1024**3)}':  total size of all rpms installed
  18. rpm -q --provides  package:  what the package provides
  19. rpm -q --qf '[%{obsoletes}\n]' package: show obsolete tags
  20. rpm -K package.rpm: verify package integrity
Installing
  1. rpm -ivh package.rpm: installing, verbose and show progress with ###
  2. rpm -Uvh package.rpm: updating a package
  3. rpm -Fvh *.rpm: updating the packages only if an earlier version is present
Uninstalling
  1. rpm -e package
  2. rpm -e --nodeps package
Check Dependency
$ rpm --test -ivh package.rpm


Rebuild RPM db (when it is corrupted or yum stuck)
# rm /var/lib/rpm/__db*
# rpm --rebuilddb

No comments: