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: make a list of installed packages using the command line interface (CLI) in the Red Hat-based system.
Key Takeaways
- Learning the process of listing all installed app packages in your system.
Requirements
- A Red Hat-based distribution is required.
[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 “How to Groupinstall Packages Using DNF”. To know how to install app packages using yum, check this detailed article on “How to Install RPM Packages Using YUM”.
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:
Steps to Follow >
➊ First, open the Terminal on your system.
➋ Secondly, type the following command:
dnf list installed
- 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
After 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
- 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:
Steps to Follow >
➊ First, type the following command in the terminal:
dnf list installed | grep audacity
- 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:
Steps to Follow >
➊ First, open the terminal.
➋ Secondly, run the following command:
dnf list --extras
- 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:
Steps to Follow >
➊ First, open the terminal.
➋ Secondly, execute the following command:
dnf list --obsoletes
- 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:
Steps to Follow >
➊ 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
- 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:
Steps to Follow >
➊ First, open the terminal.
➋ Secondly, run the following command:
dnf history userinstalled
- 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:
Steps to Follow >
➊ First, open the terminal.
➋ Secondly, run the following command:
dnf repoquery --installed
- 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:
Steps to Follow >
➊ 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:
Steps to Follow >
➊ 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.