Friday, 22 July 2016

rough rpm (and dpkg-query) quickref

HOWTO rpm quickref, -ql list files in packages, -qf show rpm source of files

Syntax Debian/Ubuntu/.. Description Example(s)
rpm -ivh [--force] {rpm-file(s)}
yum install {package-name} [more packages ...]
apt-get install {pac... Install the package rpm -ivh ~/Downloads/wireshark-1.99.0-1.i686.rpm
rpm -Uvh {rpm-file} dpkg -Gi package(s).deb Upgrade package rpm -Uvh ~/Downloads/wireshark-1.99.0-1.i686.rpm
rpm -Uvh --test ~/Downloads/wireshark-1.99.0-1.i686.rpm
rpm -ev {package} dpkg -r package Erase/remove/ an installed package rpm -ev wireshark
rpm -ev --nodeps {package} Erase/remove/ an installed package without checking for dependencies rpm -ev --nodeps wireshark
rpm -ev --noscripts {package} Erase/remove/ an installed package without running script
## sometimes needed when the pre/post install/uninstall script has error
rpm -ev --noscripts `rpm -qg OMN`
rpm -qa
rpm -qa "*pattern*"
 dpkg-query -S {file-pattern} Display list all installed packages rpm -qa
rpm -qa | less
rpm -ql {package} dpkg -L package List files in package rpm -ql wireshark
rpm -qi {package} dpkg -s package Display installed information along with package version and short description rpm -qi wireshark
rpm -qf {/path/to/file}  dpkg-query -S {file-pattern} Find out what package a file belongs to i.e. find what package owns the file rpm -qf /apps/omn/bin
dpkg-query -S $(which bono)
rpm -q p {rpm-file}
rpm -qi p {rpm-file}
rpm -ql p {rpm-file}

dpkg -I package.deb
dpkg-query -L {package}
List version of rpm file.
List files packaged in rpm file.
List detailed info in rpm file.
rpm -ql wireshark
rpm -qlp ~/Downloads/wireshark-1.99.0-1.i686.rpm
rpm -ql -p ~/Downloads/wireshark-1.99.0-1.i686.rpm
dpkg-query -L bono
rpm --rebuilddb Sometimes necessary if problems, rpm db has become corrupt.
rpm -qa --last Display list of all recently installed RPMs rpm -qa --last
rpm -qa --last | less
rpm -q --requires package
rpm -qR {package}
rpm -qR -p {.rpm-file}
rpm -q --whatrequires package
dpkg -s package | grep ^Depends
dpkg --purge --dry-run package
Find out what dependencies a rpm package or file has.
List packages dependant on this package. 
rpm -qpR ~/Downloads/wireshark-1.99.0-1.i686.rpm
rpm -qR wireshark
rpm -qg {group} dpkg-query -g {g}
dpkg-query -G {g}
List all packages in group rpm -qg "System Environment/Libraries"
rpm -qg "Applications/Internet"
rpmquery -l -p {rpm-file} // rpmquery -l {package} List files packaged in rpm file. Same as rpm -ql.

sudo rpm --import

yum install `cat /tmp/rpm.list`

$ rpm --help
Usage: rpm [OPTION...]

Query/Verify package selection options:
  -a, --all                         query/verify all packages
  -f, --file                        query/verify package(s) owning file
  -g, --group                       query/verify package(s) in group
  -p, --package                     query/verify a package file
      --pkgid                       query/verify package(s) with package identifier
      --hdrid                       query/verify package(s) with header identifier
      --triggeredby                 query the package(s) triggered by the package
      --whatrequires                query/verify the package(s) which require a dependency
      --whatprovides                query/verify the package(s) which provide a dependency
      --nomanifest                  do not process non-package files as manifests

Query options (with -q or --query):
  -c, --configfiles                 list all configuration files
  -d, --docfiles                    list all documentation files
  -L, --licensefiles                list all license files
      --dump                        dump basic file information
  -l, --list                        list files in package
      --queryformat=QUERYFORMAT     use the following query format
  -s, --state                       display the states of the listed files

Verify options (with -V or --verify):
      --nofiledigest                don't verify digest of files
      --nofiles                     don't verify files in package
      --nodeps                      don't verify package dependencies
      --noscript                    don't execute verify script(s)

Install/Upgrade/Erase options:
      --allfiles                    install all files, even configurations which might otherwise be skipped
      --allmatches                  remove all packages which match (normally an error is generated if specified
                                    multiple packages)
      --badreloc                    relocate files in non-relocatable package
  -e, --erase=+            erase (uninstall) package
      --excludedocs                 do not install documentation
      --excludepath=          skip files with leading component
      --force                       short hand for --replacepkgs --replacefiles
  -F, --freshen=+      upgrade package(s) if already installed
  -h, --hash                        print hash marks as package installs (good with -v)
      --ignorearch                  don't verify package architecture
      --ignoreos                    don't verify package operating system
      --ignoresize                  don't check disk space before installing
  -i, --install                     install package(s)
      --justdb                      update the database, but do not modify the filesystem
      --nodeps                      do not verify package dependencies
      --nofiledigest                don't verify digest of files
      --nocontexts                  don't install file security contexts
      --noorder                     do not reorder package installation to satisfy dependencies
      --noscripts                   do not execute package scriptlet(s)
      --notriggers                  do not execute any scriptlet(s) triggered by this package
      --nocollections               do not perform any collection actions
      --oldpackage                  upgrade to an old version of the package (--force on upgrades does this automatically)
      --percent                     print percentages as package installs

                relocate the package to , if relocatable
      --relocate==        relocate files from path to
      --replacefiles                ignore file conflicts between packages
      --replacepkgs                 reinstall if the package is already present
      --test                        don't install, but tell if it would work or not
  -U, --upgrade=+      upgrade package(s)

Common options for all rpm modes and executables:
  -D, --define='MACRO EXPR'         define MACRO with value EXPR
      --undefine=MACRO              undefine MACRO
  -E, --eval='EXPR'                 print macro expansion of EXPR
      --macros=           read instead of default file(s)
      --nodigest                    don't verify package digest(s)
      --nosignature                 don't verify package signature(s)
      --rcfile=           read instead of default file(s)
  -r, --root=ROOT                   use ROOT as top level directory (default: "/")
      --dbpath=DIRECTORY            use database in DIRECTORY
      --querytags                   display known query tags
      --showrc                      display final rpmrc and macro configuration
      --quiet                       provide less detailed output
  -v, --verbose                     provide more detailed output
      --version                     print the version of rpm being used

Options implemented via popt alias/exec:
      --scripts                     list install/erase scriptlets from package(s)
      --setperms                    set permissions of files in a package
      --setugids                    set user/group ownership of files in a package
      --conflicts                   list capabilities this package conflicts with
      --obsoletes                   list other packages removed by installing this package
      --provides                    list capabilities that this package provides
      --requires                    list capabilities required by package(s)
      --info                        list descriptive information from package(s)
      --changelog                   list change logs for this package
      --xml                         list metadata in xml
      --triggers                    list trigger scriptlets from package(s)
      --last                        list package(s) by install time, most recent first
      --dupes                       list duplicated packages
      --filesbypkg                  list all files from each package
      --fileclass                   list file names with classes
      --filecolor                   list file names with colors
      --fscontext                   list file names with security context from file system
      --fileprovide                 list file names with provides
      --filerequire                 list file names with requires
      --filecaps                    list file names with POSIX1.e capabilities

Help options:
  -?, --help                        Show this help message
      --usage                       Display brief usage message
error: can't create transaction lock on /var/lib/rpm/.rpm.lock (Interrupted system call)
warning: waiting for transaction lock on /var/lib/rpm/.rpm.lock
$ for p in $(rpm -qa); do rpm -qi $p; done |less
Name        : wireshark
Version     : 1.99.0
Release     : 1
Architecture: i686
Install Date: Fri 20 Jun 2014 13:09:02 IST
Group       : Applications/Internet
Size        : 132408893
License     : GPL+
Signature   : (none)
Source RPM  : wireshark-1.99.0-1.src.rpm
Build Date  : Fri 20 Jun 2014 11:34:04 IST
Build Host  :
Relocations : (not relocatable)
Packager    : Gerald Combs
URL         :
Summary     : Network protocol analyzer
Description :
Wireshark is a free network protocol analyzer for Unix and Windows. It
allows you to examine data from a live network or from a capture file
on disk. You can interactively browse the capture data, viewing summary
and detail information for each packet. Wireshark has several powerful
features, including a rich display filter language and the ability to
view the reconstructed stream of a TCP session.

This package contains command-line utilities, plugins, and documentation for
Wireshark. A GTK+ and a Qt graphical user interface are packaged separately.

Name        : wireshark-gnome
Version     : 1.10.6
Release     : 1.fc19
Architecture: i686
Install Date: Fri 09 May 2014 10:20:48 IST
Group       : Applications/Internet
Size        : 2608072
License     : GPL+
Signature   : RSA/SHA256, Sun 09 Mar 2014 17:36:55 GMT, Key ID 07477e65fb4b18e6
Source RPM  : wireshark-1.10.6-1.fc19.src.rpm
Build Date  : Sat 08 Mar 2014 18:01:27 GMT
Build Host  :
Relocations : (not relocatable)
Packager    : Fedora Project
Vendor      : Fedora Project
URL         :
Summary     : Gnome desktop integration for wireshark
Description :
Contains wireshark for Gnome 2 and desktop integration file

$ for p in $(rpm -qa); do rpm -qi $p; done |grep Group |sort |uniq
compression standard from the Joint Photographic Experts Group (JPEG).
font that was released to the TeX Users Group under a liberal license.
generously donated to the TeX Users' Group when Y&Y closed its
Group       : Amusements/Games
Group       : Amusements/Graphics
Group       : Applications/Archiving
Group       : Applications/Communications
Group       : Applications/Databases
Group       : Applications/Editors
Group       : Applications/Emulators
Group       : Applications/Engineering
Group       : Applications/File
Group       : Applications/Internet
Group       : Applications/Multimedia
Group       : Applications/Productivity
Group       : Applications/Publishing
Group       : Applications/System
Group       : Applications/Text
Group       : Development/Debuggers
Group       : Development/Documentation
Group       : Development/Java
Group       : Development/Languages
Group       : Development/Libraries
Group       : Development/Libraries/Java
Group       : Development/System
Group       : Development/Tools
Group       : Development/Tools/Building
Group       : Documentation
Group       : OMN
Group       : Productivity/Networking/Email/Utilities
Group       : Public Keys
Group       : System/Boot
Group       : System Environment/Base
Group       : System Environment/Daemons
Group       : System Environment/Kernel
Group       : System Environment/Libraries
Group       : System Environment/Shells
Group       : System/Libraries
Group       : Text Editors/Integrated Development Environments (IDE)
Group       : Text Processing/Markup/XML
Group       : Unspecified
Group       : User Interface/Desktops
Group       : User Interface/X
Group       : User Interface/X Hardware Support
Group       : Utilities
Summary     : NFSv4 User and Group ID Mapping Library
the GraphicsMagick Group to significantly improve the quality and performance
the Internet. It is designed by the IETF Codec Working Group and incorporates
TrouSerS is an implementation of the Trusted Computing Group's Software Stack
Users Group NTG.
Yahoo!, Jabber, Bonjour, Gadu-Gadu, ICQ, IRC, Novell Groupwise, QQ,

Another quickref rpm and dpkg: