#775771 apt: restrict apt-cache search results to installed packages

Package:
apt
Source:
apt
Description:
commandline package manager
Submitter:
Kamaraju Kusumanchi
Date:
2015-03-26 12:42:04 UTC
Severity:
wishlist
#775771#5
Date:
2015-01-19 18:59:50 UTC
From:
To:
Dear Maintainer,

The --installed option in apt-cache currently works only with "depends",
"rdepends" arguments. Could you please extend that to "search" as well?

For example, if I do

rajulocal@hogwarts ~ % apt-cache search konsole
konsolekalendar - konsole personal organizer
konsole - X terminal emulator
konsole-dbg - debugging symbols for the KDE X terminal emulator
plasma-runners-addons - additional runners for Plasma and Krunner
plasma-widgets-addons - additional widgets for Plasma
libtsm-dev - Terminal-emulator State Machine - development
libtsm3 - Terminal-emulator State Machine - runtime
tilda - Gtk based drop down terminal for Linux and Unix
yakuake - Quake-style terminal emulator based on KDE Konsole technology

However, AFAIK, there is no simple way to limit the results to just installed
packages.

rajulocal@hogwarts ~ % apt-cache search --installed konsole
E: Command line option --installed is not understood

As a work around, I currently do

rajulocal@hogwarts ~ % apt-cache search konsole | cut -f 1 -d ' ' | xargs dpkg
-l 2>&1 | grep ^ii
ii  konsole               4:4.14.2-1   amd64        X terminal emulator
ii  konsolekalendar       4:4.12.4-1   amd64        konsole personal organizer
ii  plasma-runners-addons 4:4.13.3-1   amd64        additional runners for
Plasma and Krunner
ii  plasma-widgets-addons 4:4.13.3-1   amd64        additional widgets for
Plasma

But it would be nice if this is done natively in apt-cache itself.

thanks
raju
--
Kamaraju S. Kusumanchi
http://malayamaarutham.blogspot.com/

#775771#10
Date:
2015-03-26 12:38:03 UTC
From:
To:
should have not I RTFM more carefully? ;-)  Thanks David

indeed... I was not spotted that behavior because the output was anyways
piped to dpkg --purge ;)    It just was more semantically correct to
list only installed packages. And such operation seems to be in demand,
hence CCing now found #775771 (morning search is always better ;-) )

I don't think so -- if people explicitly asked for --installed, they
meant it.  So if anything, it should only become better ;-)

well -- the script is a part of the source package which is stuck in NEW
for ... 7 months now, thus can't reportbug, but already fixed it up ;)