5 Ways to List Installed Packages in RHEL Using DNF With Cases

LINUX
FUNDAMENTALS
A Complete Guide for Beginners Enroll Course Now

DNF (Dandified YUM) is the latest package manager for Red Hat-based systems like RHEL, Fedora, and CentOS. It is built on top of the Yum package manager. It enhances package management in Linux/Unix systems with its advanced features, making installation, dependency resolution, version control, and package uninstallation easier. In this comprehensive guide, using the DNF package manager I will delve into a fundamental aspect of package management to make a list of installed packages using the command line interface (CLI) in the Red Hat-based system.

To list or show all the installed packages on RHEL, CentOS, and Fedora, check the following commands:

  1. Using rpm command: rpm -qa
  2. Using yum command: yum list installed
  3. Using dnf command: dnf list installed

[Distro Used Throughout the Tutorial: RHEL 9.2]

5 Methods to List All Installed Packages Using DNF

When it comes to package management, knowing which package is installed is a crucial task. In this guide, I will unveil 5 different effective methods to list installed packages using dnf in the Command Line Interface (CLI) in any Red Hat-based distributions. In this article, I will show you all the ways in which you can check installed app packages in your Linux system.

If you want to install an app package from your local file using dnf, go through this simple article “How to Install Local Package Using DNF”. If you want to learn about groupinstall using dnf, check this short article “2 Ways to Install Group Packages Using DNF”. To know how to install app packages using dnf, check this detailed article on “How to Install RPM Packages Using DNF”.

Method 01: Using the “dnf list” Command

In this method, I will explore the most direct approach to list some specific/all-installed app packages in your system. The “dnf list” command provides a comprehensive view of the installed packages in your Linux/Unix system, whether you are looking for a specific package or the list of all packages installed.

Case 01: List All Installed Packages Using “dnf”

If you want to list all installed packages in your Red Hat-based system using the “dnf list” command is the most simplest and efficient way. Follow these steps to do that:

  1. First, open the Terminal on your system.

  2. Secondly, type the following command:

    dnf list installed
    EXPLANATION
    • dnf: Package manager in Red Hat-based distributions.
    • list: This option can show all available and installed packages in your system.
    • installed: Tells the list option to show the installed packages.

    list all installed packages using dnf list command

  3. After that, hit ENTER. All the app packages that are installed in your system will be shown in the terminal. It will look similar to the above image.

  4. If you want to check the total number of packages installed in your system then run the following command:

    dnf list installed | wc -l
    EXPLANATION
    • | (pipe): Pipe is used to redirect the standard output.
    • wc: Count the number of lines, words, and characters.
    • l: Tells the wc command to count the number of lines.

    After running this, the number of installed packages will be shown in your terminal like the following image:

    check the number of installed app packages in Red Had based system

  5. Usually listing all installed packages in the terminal clutter the terminal. If you want to avoid that, then execute the following command. It will instead list all your installed app packages’ names in a paginated manner in the less viewer.

    dnf list installed | less
    EXPLANATION
    • less: Command line pager that allows to view the text output in a paginated manner.

    command to list all installed packages in less viewer

    show all installed packages in less viewer

    After executing the command the ‘less’ viewer will open with all the installed app packages listed like the previous images.

Case 02: Check if a Specific App is Installed Directly

If you want to check if a particular app package is installed in your Red Hat-based system directly using the “yum list” command, first open the Terminal on your system and execute the following command:

dnf list installed audacity
EXPLANATION
  • audacity: Name of the package that I am checking.

check installation status of a particular app package using dnf list command

If the app package you are checking is installed, you will see results similar to the above image in your terminal.

Case 03: Check a Specific App Package From All Installed Packages List

You can also check if a specific app package is installed from the list of all installed app packages. In order to do that execute these straightforward tasks:

  1. First, type the following command in the terminal:

    dnf list installed | grep audacity
    EXPLANATION
    • grep: Grep is used to find a specific pattern or string.
  2. Now hit ENTER.

    check if a specific app package is installed from a list of all installed app packages using dnf list command

    If that package is installed in your system, your terminal will look similar to the previous image.

Case 04: List All Extra Packages Using “dnf”

Sometimes you install packages that are not present in the repositories that are present in your repository list. You can use the “extras” option with the “dnf list” command to list all of those packages installed in your system that are not present in the known repositories. To list all extra app packages from a local system using the “dnf list” command, just follow this step-by-step process:

  1. First, open the terminal.

  2. Secondly, run the following command:

    dnf list --extras
    EXPLANATION
    • extras: List extra packages installed in your system.

    list all extra packages in command line interface (CLI)

  3. In the terminal you will see a list of all the extra packages installed in your system as shown in the previous image. Since I do not have any extra packages installed in my system, I’m getting a blank response.

Case 05: List All Obsoletes Packages

Sometimes some of your installed packages may be replaced by newer versions or their functionality may be integrated into other packages. To list all obsolete packages in your system using the “dnf list” command, follow these steps:

  1. First, open the terminal.

  2. Secondly, execute the following command:

    dnf list --obsoletes
    EXPLANATION
    • obsoletes: List all obsolete packages installed in your system.

    list all obsolete packages in command line interface (CLI)

  3. In the terminal you will see a list of all the obsolete packages installed in your system similar to the above image. But, Since I do not have any obsolete package installed in my system, I’m getting a blank response.

Method 02: Using the “dnf info” Command to List Installed App Package

In the Red Hat-based system, the “dnf info” command is a very powerful tool that can give details info about not just the package installed in your system but also for packages in the remote repositories that are available for you to install.

Using this method you can also check whether an app package is installed in your system or not. To check if a particular app package is installed in your system along with its details, first, open your terminal and run the following command to check if a specific app package is installed in your system:

dnf info audacity
EXPLANATION
  • info: display more detailed info about your app package.

show detail information about an app package

After that, all details about that app package will be shown in the terminal like the previous image. Now, if that specific app is installed in your system then in the detailed info section it will be denoted as “Installed Packages”, otherwise it will be denoted as “Available Packages”.

Method 03: Using the “dnf repository-packages” Command

To manage an efficient Linux/Unix you may encounter a situation where you have to install a package from a specific repository. For this kind of scenario, the “dnf repository-packages” command becomes a blessing. This command allows you to deal with all available and installed packages of that specific repository. To list all installed packages from a specific repository follow the following process:

  1. To begin with, open your terminal and type the following command to list all installed packages from a specific repository:

    dnf repository-packages epel list installed
    EXPLANATION
    • repository-packages: Command dnf to perform operations related to repositories and packages contained within them.
    • epel: Specific repository I want to check.

    show all installed packages from a specific repository using dnf repository-packages command

  2. Now, hit ENTER. All of the app packages you installed from your specified repository will be shown in the terminal like the above image.

Method 04: Using the “dnf history” Command to List Installed Packages

Another effective way to list all installed packages using DNF is by utilizing the “dnf history” command. This command provides a historical overview of package transactions on your system, including installations, updates, and removals without using the DNF package manager. By using the option with this command, you can extract a list of packages installed outside of DNF and packages not installed as dependencies in your system. To do that follow these steps:

  1. First, open the terminal.

  2. Secondly, run the following command:

    dnf history userinstalled
    EXPLANATION
    • history: This command allows you to access the package transaction history in your system.
    • userinstalled: Displays manually installed packages, including those not installed as dependencies or through DNF.

    show all manually installed app packages using dnf history command

  3. In the terminal you will see a list of all manually installed packages in your system similar to the image above.

Method 05: Using the “dnf repoquery” Command

The “dnf repoquery” command is a powerful tool that offers extensive querying capabilities for installed packages. This command allows you to uncover detailed information about your app packages. In this section, I will explore how you can harness the potential of the “dnf repoquery” command to list installed packages with different queries.

Case 01: List All Installed Packages Using “dnf”

To list all installed packages in your Red Hat-based system using the “dnf repoquery” command is a very simple process. Follow these steps to do that:

  1. First, open the terminal.

  2. Secondly, run the following command:

    dnf repoquery --installed
    EXPLANATION
    • repoquery: Provide query information about packages and repositories.

    show all installed app packages using dnf repoquery command

  3. As shown in the previous image, you will see a list of all installed packages of your system.

Case 02: Check if a Specific App is Installed

Sometimes you only want to verify the presence of a single package. You can instantly check if a package is installed using the “dnf repoquery” command. To check if a particular app package is installed in your system follow this simple process:

  1. To begin with, open your terminal and type the following command to list all installed packages from a specific repository:

    dnf repoquery --installed audacity

    check installation status of a particular app package using dnf repoquery command

  2. Now, hit ENTER. If the specific app package you want to check is installed it will be shown in the terminal like the above image.

Case 03: List All Manually Installed Packages

If you want to list all the packages installed by the user you can use “userinstalled” of the “dnf repoquery” command. Follow these simple steps for that:

  1. First, open the terminal.

  2. Secondly, run the following command:

    dnf repoquery --userinstalled

    show all manually installed app packages using dnf repoquery command

  3. In the terminal, you will see a list of all manually installed packages in your system similar to the previous image.

Conclusion

To wrap it up in this article I have delved into different methods of listing installed packages using dnf package manager in Red Hat-based distributions. I hope with these insights you will be able to manage your Linux/Unix system more efficiently.

People Also Ask

How do I list installed packages in Linux?

The command to check installed packages in Linux command changes depending on the Linux distribution and package managers. The apt list --installed is used in Debian-based Linux, dnf list installed is used in Red Hat-based distribution, and for Arch Linux pacman -Q is used to list all installed packages.

How can you check if a package is installed?

To check if a package is installed in Debian-based systems, the apt list --installed package_name command, in Red Hat-based distributions dnf list installed package_name command, and for Arch Linux the pacman -Q package_name command is used.

Where does DNF install files?

In Red Hat-based distributions you can know where a particular app package file is installed by executing the dnf repoquery -l <package_name> command in the terminal.

What is the dnf command?

DNF(Dandified YUM) is the go-to package manager in modern Red Hat-based Linux systems like Fedora, RHEL, CentOS, etc. It streamlines software installation, updates, uninstallation, and overall package management via the command line. DNF replaces the older YUM package manager by offering enhanced capabilities and efficiency.


Related Articles


<< Go Back to Package Installation in Linux | Package Management in Linux | Learn Linux Basics

4.9/5 - (15 votes)
Ridoy Chandra Shil

Hello everyone. I am Ridoy Chandra Shil, currently working as a Linux Content Developer Executive at SOFTEKO. I am a Biomedical Engineering graduate from Bangladesh University of Engineering and Technology. I am a science and tech enthusiast. In my free time, I read articles about new tech and watch documentaries on science-related topics. I am also a big fan of “The Big Bang Theory”. Read Full Bio

3 thoughts on “5 Ways to List Installed Packages in RHEL Using DNF With Cases”

  1. Sometimes if I suspect I have a package already installed, I will do the following:
    packagename –version

    example:
    gimp –version

    if it returns a version mumber, i know i have that package installed.

    Reply
    • Hello nevermind,
      I hope you are having a nice day. You are correct that using packagename --version can check the version number of a specific package to determine if it is installed. However, it is worth noting that not all packages support the --version option on RHEL systems. The methods I have outlined in the article provide more universally applicable ways to list installed packages. Thank you for your input!

      Reply
  2. This is a useful dnf guide. Thanks for taking the time to put it together.

    I’m using MX Linux (Debian based – https://distrowatch.com/table.php?distribution=mx) as a virtual machine on Fedora and as the primary OS on several mini-PCs, and it comes packaged with a utility that shows user-installed packages. The command for getting the same info from dnf is not easily found, but you’ve included those details here. Thank you!

    Greg.

    Reply

Leave a Comment