According to the manual, it

   search regex...
       search performs a full text search on all available package lists
       for the POSIX regex pattern given, see regex(7). It searches the
       package names and the descriptions for an occurrence of the regular
       expression and prints out the package name and the short
       description, including virtual package names. If --full is given
       then output identical to show is produced for each matched package,
       and if --names-only is given then the long description is not
       searched, only the package name is.

   --names-only, -n
       Only search on the package names, not the long descriptions.
       Configuration Item: APT::Cache::NamesOnly.

However, I came across a strange situation:

$ apt-cache search --names-only 'kde*' | grep tkcv
tkcvs - Graphical front-end to CVS and Subversion

Why in the world would the command above match tk8.6-doc? Braiam and I spent a few minutes chatting about this and he noticed that

$ apt-cache show tkcvs | grep -i kd
Replaces: tkdiff
Provides: tkdiff

So, Braiam suggested that it's matching the Replaces field as well which makes a certain amount of sense in the case of changing package names. OK then, but what about:

$ apt-cache search --names-only 'kde*' | grep tk8.6
tk8.6-doc - Tk toolkit for Tcl and X11, v8.6 - manual pages
$ apt-cache show tk8.6-doc | grep -i kd
Provides: tkdoc
Conflicts: tkdoc

Here it is either matching the Conflicts or the Provides fields and I can't twist the meaning of --names-only to make it match those fields. So, what exactly does --names-only search through? Is it the names of all packages that are mentioned in a package's description? It is clearly not matching the package name alone.

  • If I have to guess it's matching the virtual package name, and since apt-cache doesn't handle well the virtual packages it shows you the one with higher version.
    – Braiam
    Mar 10, 2014 at 3:50

1 Answer 1


It turns out that apt-cache search --names-only also searches for Provides. The man page needs to be updated. Here is a link to the bug report regarding the same.

As per bug #98695¹, it seems that "apt-cache search --names-only" is also looking into "Provides" field while man page suggests that only package name is queried.

I think the manual page of apt-cache should be updated accordingly to reflect the current state of the paremeter.


This was the wishlist that caused the behavior of apt-cache search to be changed to search Provides in addition to the package name.

  • I think you've nailed it. Every case I can find seems to be matching against a Provides field. I'll give it a little while longer and come back and accept. Thanks!
    – terdon
    Mar 10, 2014 at 4:10
  • @terdon You question prompted to hunt for this. I've myself wondered about the issue you reported a couple of times earlier, but didn't really chase it.
    – devnull
    Mar 10, 2014 at 4:15
  • Jesus, why would they wish for something like that... why wouldn't they add a new --names-and-provides-only parameter, or ANY other way...
    – bviktor
    Jul 12, 2019 at 9:52

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.