RHEL Packages

RPM

Below are the most commonly used rpm commands that can be used with RHEL-6,7 and 8.

files and directories
/var/lib/rpm
Displaying
rpm -qa                # all packages
rpm -q                 # single package
rpm -qf                # file belongs
rpm -qi <package>      # very detailed
rpm -ql <package>      # list files in a package
Installing and Removing
rpm -Uhv               # updates/installs if not already)
rpm -ihv               # install

rpm -e <package>       # remove
Verifying
rpm -V <package>

YUM

Yellowdog Updater, Modified (YUM) has been around for a while and is supported in RHEL 6, 7 and 8.

Files and Directories
/etc/yum.repos.d
Repositories
yum repoinfo list
yum repolist
yum repo-pkgs <repo> list

yum --enablerepo=<repo>        # enable a repository
yum --disablerepo=<repo>       # disable a repository
Queries
yum list available             # list all available packages
yum list installed             # list all installed packages
yum list all                   # list all available and installed packages
yum list kernel                # list all available and installed kernel packages

yum info <package>             # information about a package

yum deplist <package           # list dependencies of a package
yum provides <command>         # find package that proides the specific command
yum search <package>           # search for a package
yum updateinfo security        # get updates on security packages
yum --changelog <package>      # display changelog of a specific package

yum grouplist                  # get a list of all the package groups
yum groupinfo <group>          # get information about a specific group
Maintain and Features
yum clean <package>            # delete package in cache
yum clean all                  # clean all packages from cache

yum check                      # check the yum db

yum history list               # list all yum previous commands
Install/Remove/Upgrade
yum install <package>          # install a specific package
yum update <package>           # update a specific package
yum reinstall <package>        # reinstall a specific package
yum erase <package>            # remove a specific package

yum groupinstall <group>       # install a specific group package
Other useful commands
yum find-repos-of-install              # find which repo a package comes from
yum repotrack <package>                # download a specific package with its dependencies
yum show-installed                     # list installed RPM packages and stats
yumdownloader <package>                # download the specific package to current directory
yum install --downloadonly <package>   # download but don't install specific package

DNF

Dandified YUM (DNF) is the new package manager for RHEL 8 onwards

Files and Directories
/etc/dnf/dnf.conf
/etc/yum.repos.d
Repositories
dnf repolist                         # list repos
dnf repoquery                        # searches DNF repos
dnf config-manager --add-repo=<URL>  # add a remote repo

dnf repository-packages repo-id remove  # remove all packages from specific repo
Queries
dnf list --all                 # list all installed
dnf list <expression>          # use expression to list installed packages

dnf list <one of the below>    # various list options

[--installed|--available|--extras|--obsoletes|--recent|--upgrades]

dnf info <package>             # display information about a specific package
dnf provides <file>            # find what packages has specific file

dnf search <term>              # search for a term in a package

dnf group summary <group       # overview of what groups are installed or available
dnf group info <group>         # show package list of a group
dnf group list <group>         # list all matching groups
Maintainance and Features
dnf history list                   # list dnf history commands
dnf history redo <transaction>     # redo a specific dnf command
dnf history rollback <transaction> # rollback a specific command
dnf history undo <transaction>     # undo a specific command

Install/Remove/Upgrade
dnf install <package>          # install a specific package
dnf reinstall <package>        # reinstall a specific package

dnf remove <package>           # remove a specific package
dnf erase <package>            # remove a specific package
dnf autoremove                 # uninstall orphaned packages

dnf check-update               # check if updates are available
dnf upgrade                    # update packages to latest version

dnf group install <group>      # install a specific group
dnf group remove <group>       # remove a specific group
dnf group upgrade <group>      # upgrade a specific group