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:
- Using rpm command:
rpm -qa
- Using yum command:
yum list installed
- 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:
-
First, open the Terminal on your system.
-
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.
-
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.
-
If you want to check the total number of packages installed in your system then run the following command:
dnf list installed | wc -l
EXPLANATIONAfter running this, the number of installed packages will be shown in your terminal like the following image:
-
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.
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
- audacity: Name of the package that I am checking.
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:
-
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.
-
Now hit ENTER.
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:
-
First, open the terminal.
-
Secondly, run the following command:
dnf list --extras
EXPLANATION- extras: List extra packages installed in your system.
-
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:
-
First, open the terminal.
-
Secondly, execute the following command:
dnf list --obsoletes
EXPLANATION- obsoletes: List all obsolete packages installed in your system.
-
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
- info: display more detailed info about your 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:
-
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.
-
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:
-
First, open the terminal.
-
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.
-
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:
-
First, open the terminal.
-
Secondly, run the following command:
dnf repoquery --installed
EXPLANATION- repoquery: Provide query information about packages and repositories.
-
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:
-
To begin with, open your terminal and type the following command to list all installed packages from a specific repository:
dnf repoquery --installed audacity
-
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:
-
First, open the terminal.
-
Secondly, run the following command:
dnf repoquery --userinstalled
-
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
- How to Show List of Installed Packages Using YUM [2 Cases]
- How to Check if Package is Installed Using YUM [3 Solutions]
- How to Install Specific Version of a Package Using YUM
- How to Install Local Package Using YUM [2 Practical Cases]
- How to List Installed Packages Using RPM [2 Practical Cases]
- 3 Ways to Install Pacman Package Manager in Ubuntu
- How to Install RPM Packages Using YUM [4 Interactive Cases]
- How to Install Local Package Using RPM [A Quick Guide]
- How to Install RPM Packages From Text File [5 Simple Cases]
<< Go Back to Package Installation in Linux | Package Management in Linux | Learn Linux Basics
FUNDAMENTALS A Complete Guide for Beginners
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.
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!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.