Bug 1301322

Summary: [RFE] dnf search does not show if package is installed
Product: [Fedora] Fedora Reporter: Niels Kobschätzki <niels>
Component: dnfAssignee: Packaging Maintenance Team <packaging-team-maint>
Status: NEW --- QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: low Docs Contact:
Priority: unspecified    
Version: rawhideCC: 8ru2u4gz, alex.wayfer, brandon+redhat, bugzilla.redhat.com, chenhaixing, hujq, hute37, jrohel, jsilhan, jturnmire, mdomonko, mluscon, nikau7, ogjerstad, packaging-team-maint, pkratoch, raul.a.armas, redhat, snemec, vmukhame, www.tfrei.de
Target Milestone: ---Keywords: FutureFeature, Reopened, Triaged
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2016-01-25 13:28:27 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Niels Kobschätzki 2016-01-24 06:00:07 UTC
Description of problem:
FutureFeature
"dnf search" shows a list of packages as a result of the search. The list doesn't show which of the packages in the results are already installed.

Version-Release number of selected component (if applicable):
1.1.5

How reproducible:
Install a package with dnf and search for it

Steps to Reproduce:
1.dnf install "some package"
2.dnf search "some package"


Actual results:
A list of search results which includes the installed package without further information if it is installed

Expected results:
The package should have something like [installed] after its name or description

Additional info:

Comment 1 Michal Domonkos 2016-01-25 13:28:27 UTC
By design, showing this kind of status is not in the scope of the search command.  To list the installed packages, please use the "dnf list installed" command instead.

Comment 2 Tobias Frei 2020-08-17 18:04:06 UTC
(In reply to Michal Domonkos from comment #1)
> By design, showing this kind of status is not in the scope of the search
> command.  To list the installed packages, please use the "dnf list
> installed" command instead.

Please reconsider this design and reopen the bug as a low-priority feature request.

A full list of installed packages is not a useful substitute for the suggested "installed" indicator in a list of package search results, such as conveniently, fortunately shown by package managers like apt.

Comment 3 Michal Domonkos 2020-08-18 06:22:00 UTC
Tobias, that makes sense.  I'm reopening this for the DNF folks to revisit.

Comment 4 Jaroslav Rohel 2020-08-24 10:38:58 UTC
Try to use "repoquery" command. It is not as "apt search", but it can help.
"repoquery" allows to define format of output (--qf 'format string') and to add reason of instalation to the output.

Examples:
search keys only in installed packages: "dnf repoquery --installed key1 key2 ..."

search keys only in installed packages and print info about reason of  installation - user, dependency, ... : "dnf repoquery --installed --qf '%{reason} %{name}-%{evr}.%{arch}' key1 key2 ..."

search keys in all packages and print info about reason of installation - user, dependency, ..., (none) - if package is not installed: "dnf repoquery  --installed --available --qf '%{reason} %{name}-%{evr}.%{arch}' key1 key2 ..." (If a package is available in a repository and is installed too, it is printed two times - as installed, and as (none) for repository).

Comment 5 Raúl 2020-10-07 07:22:36 UTC
I think that is an important missing feature.

Comment 6 Giovanni Pelosi 2021-01-20 22:43:48 UTC
The point is to look for "uninstalled" things to install.

The equivalent apt is:

apt search xfce | grep -v installed

Comment 7 chenhaixing 2022-06-20 03:41:30 UTC
Hi,I've read your question.
I think the purpose of "dnf search" is to search for keywords.
Command:
dnf list --installed
dnf list --installed | grep keywords
It displays the installed packages.