Search

Chapter 4. Searching for RHEL 9 content

download PDF

In the following sections, learn how to locate and examine content in the AppStream and BaseOS repositories in Red Hat Enterprise Linux 9 by using DNF.

4.1. Searching for software packages

To identify which package provides the software you require, you can use DNF to search the repositories.

Procedure

  • Depending on your scenario, use one of the following options to search the repository:

    • To search for a term in the name or summary of packages, enter:

      $ dnf search <term>
    • To search for a term in the name, summary, or description of packages, enter:

      $ dnf search --all <term>

      Note that searching additionally in the description by using the --all option is slower than a normal search operation.

    • To search for a package name and list the package name and its version in the output, enter:

      $ dnf repoquery <package_name>
    • To search for which package provides a file, specify the file name or the path to the file:

      $ dnf provides <file_name>

4.2. Listing software packages

You can use DNF to display a list of packages and their versions that are available in the repositories. If required, you can filter this list and, for example, only list packages for which updates are available.

Procedure

  • List the latest versions of all available packages, including architectures, version numbers, and the repository they where installed from:

    $ dnf list --all
    ...
    zlib.x86_64         1.2.11-39.el9   @rhel-9-for-x86_64-baseos-rpms
    zlib.i686           1.2.11-39.el9   rhel-9-for-x86_64-baseos-rpms
    zlib-devel.i686     2.11-39.el9     rhel-9-for-x86_64-appstream-rpms
    zlib-devel.x86_64   1.2.11-39.el9   rhel-9-for-x86_64-appstream-rpms
    ...

    The @ sign in front of a repository indicates that the package in this line is currently installed.

    Alternatively, to display all available packages, including version numbers and architectures, enter:

    $ dnf repoquery
    ...
    zlib-0:1.2.11-35.el9_1.i686
    zlib-0:1.2.11-35.el9_1.x86_64
    zlib-0:1.2.11-39.el9.i686
    zlib-0:1.2.11-39.el9.x86_64
    zlib-devel-0:1.2.11-39.el9.i686
    zlib-devel-0:1.2.11-39.el9.x86_64
    ...

    Optionally, you can filter the output by using other options instead of --all, for example:

    • Use --installed to list only installed packages.
    • Use --available to list all available packages.
    • Use --upgrades to list packages for which newer versions are available.
    Note

    You can filter the results by appending global expressions as arguments. For more details, see Specifying global expressions in DNF input.

4.3. Listing repositories

To get an overview of repositories that are enabled and disabled on your system, you can list them.

Procedure

  1. List all enabled repositories on your system:

    $ dnf repolist

    To display only certain repositories, append one of the following options to the command:

    • Append --disabled to list only disabled repositories.
    • Append --all to list both enabled and disabled repositories.
  2. Optional: List additional information about the repositories:

    $ dnf repoinfo <repository_name>
    Note

    You can filter the results by using global expressions. For details, see Specifying global expressions in DNF input.

4.4. Displaying package information

You can query DNF repositories to display further details about a package, such as the following:

  • Version
  • Release
  • Architecture
  • Package size
  • Description

Procedure

  • Display information about one or more available packages:

    $ dnf info <package_name>

    This command displays the information for the currently installed package and, if available, its newer versions that are in the repository. Alternatively, use the following command to display the information for all packages with the specified name in the repository:

    $ dnf repoquery --info <package_name>
    Note

    You can filter the results by appending global expressions as arguments. For details, see Specifying global expressions in DNF input.

4.5. Listing package groups and packages they provide

Package groups bundle multiple packages, and you can use package groups to install all packages assigned to a group in a single step. However, before the installation, you must identify the name of the required package group.

Procedure

  1. List both installed and available groups:

    $ dnf group list

    Note that you can filter the results by appending the --installed and --available option to the dnf group list command. By using the --hidden option, you can display hidden groups in the output.

  2. List mandatory, optional, and default packages contained in a particular group:

    $ dnf group info "<group_name>"
    Note

    You can filter the results by appending global expressions as arguments. For more details, see Specifying global expressions in DNF input.

  3. Optional: View the number of installed and available groups:

    $ dnf group summary

4.6. Listing available modules and their contents

By searching for modules and displaying information about them with DNF, you can identify which modules are available in the repositories and select the appropriate stream before you install a module.

Procedure

  1. List the module information in one of the following ways:

    • List all available modules:

      $ dnf module list
      Name        Stream   Profiles                               Summary
      ...
      nodejs      18       common [d], development, minimal, s2i  Javascript runtime
      postgresql  15       client, server                         PostgreSQL server and client module
      ...
      Hint: [d]efault, [e]nabled, [x]disabled, [i]nstalled

      Use the dnf module list <module_name> command to list the same information but only for a specific module.

    • Search for which module provides a certain package:

      $ dnf module provides <package_name>

      For example, to display which module and profiles provide the npm package, enter:

      # dnf module provides npm
      npm-1:8.19.2-1.18.10.0.3.module+el9.1.0+16866+0fab0697.x86_64
      Module   : nodejs:18:9010020221009220316:rhel9:x86_64
      Profiles : common development s2i
      Repo     : rhel-9-for-x86_64-appstream-rpms
      Summary  : Javascript runtime
      ...
  2. Use one of these methods to list module details:

    • List all details about a module, including a description, list of all profiles, and a list of all packages the module provides:

      $ dnf module info <module_name>

      For example, to display details about the nodejs package, enter:

      $ dnf module info nodejs
      Name             : nodejs
      Stream           : 18
      Version          : 9010020221009220316
      Context          : rhel9
      Architecture     : x86_64
      Profiles         : common [d], development, minimal, s2i
      Default profiles : common
      Repo             : rhel-9-for-x86_64-appstream-rpms
      Summary          : Javascript runtime
      Description      : Node.js is a platform built on Chrome's JavaScript runtime...
      Requires         : platform:[el9]
      Artifacts        : nodejs-1:18.10.0-3.module+el9.1.0+16866+0fab0697.src
                       : nodejs-1:18.10.0-3.module+el9.1.0+16866+0fab0697.x86_64
                       : npm-1:8.19.2-1.18.10.0.3.module+el9.1.0+16866+0fab0697.x86_64
      ...
    • List which packages each module profile installs:

      $ dnf module info --profile <module_name>

      For example, to display this information for the nodejs module, enter:

      $ dnf module info --profile nodejs
      Name        : nodejs:18:9010020221009220316:rhel9:x86_64
      common      : nodejs
                  : npm
      development : nodejs
                  : nodejs-devel
                  : npm
      minimal     : nodejs
      s2i         : nodejs
                  : nodejs-nodemon
                  : npm
      ...

Additional resources

4.7. Specifying global expressions in DNF input

You can filter the results of dnf commands by appending one or more global expressions as arguments.

Procedure

  • Use one of the following methods if you use global expressions in dnf commands:

    • Enclose the entire global expression in single or double quotation marks:

      # dnf provides "*/<file_name>"

      Note that you must precede <file_name> either by / for an absolute path or */ to use a wildcard if the full path is unknown.

    • Escape the wildcard characters by preceding them with a backslash (\) character:

      # dnf provides \*/<file_name>

4.8. Additional resources

Red Hat logoGithubRedditYoutubeTwitter

Learn

Try, buy, & sell

Communities

About Red Hat Documentation

We help Red Hat users innovate and achieve their goals with our products and services with content they can trust.

Making open source more inclusive

Red Hat is committed to replacing problematic language in our code, documentation, and web properties. For more details, see the Red Hat Blog.

About Red Hat

We deliver hardened solutions that make it easier for enterprises to work across platforms and environments, from the core datacenter to the network edge.

© 2024 Red Hat, Inc.