Published on

Linux Packages Management

Authors
  • Name
    Jackson Chen

rpm

rpm -qa | grep squid

dnf

https://dnf.readthedocs.io/en/latest/command_ref.html

DNF is the next upcoming major version of YUM, a package manager for RPM-based Linux distributions. It roughly maintains CLI compatibility with YUM and defines a strict API for extensions and plugins.

Return values

# Return values
0 : Operation was successful.
1 : An error occurred, which was handled by dnf.
3 : An unknown unhandled error occurred during operation.
100: See check-update
200: There was a problem with acquiring or releasing of locks.

Available commands

# Available commands:
alias
autoremove
check
check-update
clean
deplist
distro-sync
downgrade
group
help
history

info    # Useful command to list dnf repositories

makecache
mark
module
provides
reinstall
remove
repoinfo
repolist
repoquery
repository-packages
search
shell
swap
updateinfo
upgrade
upgrade-minimal

Additional information

Options
Specifying Packages
Specifying Provides
Specifying File Provides
Specifying Groups
Specifying Transactions
Metadata Synchronization
Configuration Files Replacement Policy
Files

dnf command references

dnf commands

Command             Description
dnf repolist        Lists all the enabled repositories.
dnf list            Lists all the packages that are available in all enabled repositories and all packages that are installed on the system.
dnf list installed  Lists all the packages that are installed on the system.
dnf list available  Lists all the packages that are available to be installed in all enabled repositories.
dnf search string   Searches the package descriptions for the specified string.
dnf provides feature    Finds the name of the package to which the specified file or feature belongs, 
    for example:    dnf provides /etc/dnf/automatic.conf

dnf info package    Displays detailed information about a package, for example:
    dnf info dnf-automatic

dnf repoquery -l package    List the files that are contained in a package and are installed when the package is installed, for example:
    dnf repoquery -l dnf-automatic

dnf install package     Installs the specified package, including packages on which it depends, for example:
    dnf install dnf-automatic

dnf check-update    Checks whether updates exist for packages that are already installed on the system.
dnf upgrade package     Updates the specified package, including packages on which it depends, for example:
    dnf upgrade dnf-automatic
    DNF also interprets the dnf update package command as synonymous with the upgrade syntax; 
    however, this syntax is considered deprecated.

dnf upgrade         Updates all packages, including packages on which they depend.

dnf remove package  Removes the specified package. For example:
    dnf remove dnf-automatic

dnf clean all       Removes all cached package downloads and cached headers that contain information about remote packages. 
    Running this command can help clear problems that are a result of unfinished transactions or out-of-date headers.

dnf help            Displays help about dnf usage.

dnf help command    Displays help about the specified dnf command, for example:
    dnf help upgrade

dnf shell           Runs the dnf interactive shell.

dnf groups

Command             Description
dnf group list      Lists Environment Groups, that contain many subgroups; and base groups of packages that are available for installation.
                    To include hidden groups in the list and all the groups' IDs, add the --hidden -v options.

dnf group info groupname    Displays detailed information about a group. 
                            If the group is a parent group, this command lists all subgroups that it contains, 
                            alternately the command lists all packages that are in the group.
                            To include the groups' IDs, use the -v option.

dnf group install groupname     Installs all the packages in a group.
dnf group update groupname      Updates all the packages in a group.
dnf group remove groupname      Removes all the packages in a group.

dnf module commands

dnf install package
dnf module enable module-name:<moduel name>
dnf install @module-name
    Alternatively, you can use:     dnf module install module-name
dnf module info module-name
dnf module list
dnf module list module-name
dnf module provides package
dnf module remove @module-name
dnf module disable @module-name