List installed packages

How do I list only the installed packages?

$ sudo dnf list installed
Updating and loading repositories:
Repositories loaded.
No matching packages to list

I do have packages installed …

1 Like

dnf list --installed should do it.

2 Likes

Or rpm -qa can do that as well.

1 Like

The usage of dnf list is:

sudo dnf list --help
[sudo] password for asinha: 
Usage:
  dnf5 [GLOBAL OPTIONS] list [OPTIONS] [ARGUMENTS] 
                                     
Options:                             
  --showduplicates                   Show all versions of the packages, not only the latest ones.
  --installed-from-repo=REPO_ID,...  Filters installed packages by the ID of the repository they were installed from.
  --installed                        List installed packages.
  --available                        List available packages.
  --extras                           List extras, that is packages installed on the system that are not available in any known repository.
  --obsoletes                        List packages installed on the system that are obsoleted by packages in any known repository.
  --recent                           List packages recently added into the repositories.
  --upgrades                         List upgrades available for the installed packages.
  --autoremove                       List packages which will be removed by the 'dnf autoremove' command.
  --updates                          Alias for '--upgrades'
                                     
Arguments:                           
  package-spec-NI                    List of package-spec-NI to match (case insensitively)

So, dnf list installed doesn’t quite work, as installed acts as the package-spec there.

1 Like

Oh thanks! There are so many sources on the Interweb that have this command that I didn´t look twice.

I guess it used to be this command

1 Like

Yes, and dnf4 list installed still works, in fact.

Although even for dnf4, the documentation says to use --installed.

With dnf4 it worked the same with installed and --installed. With dnf5 it is limited to usind --installed. Dnf5 looks for a package named installed instead of recognizing that as an option.