Welcome to the Linux Foundation Forum!

[Lab 9.1 Basic APT Commands] "apt-cache search -n" vs. "apt-cache pkgnames"?

Hi folks, Lab description says that both commands / options (search -n as well as pkgnames) will "only find packages with [include search word] in their name".

When I use those commands, for example with the keyword "kernel", search -n will return 75 results and pkgnames only 3?

Also, "apt-cache search -n kernel" returns findings like "gap-core", which does not have a "kernel" in the package name (or is "gap-core" not the name of the package)?

Listing the Details of gap-core (using apt-cache showpkg gap-core) inclludes

Provides:
4.12.1-2 - gap-kernel-8 (= )

I guess thats where "search -n" found the keyword "kernel".

You can see, I´m fairly confused :-) Anyone able to explain what I´m missing here? I´m on Debian bookworm btw.

Many thanks in advance!

David

Best Answer

  • luisviveropena
    luisviveropena Posts: 1,234
    Answer ✓

    Hi David,

    1) Taking a look at the man page for apt-cache, it says the following:

    search regex [regex ...]
    Performs a full text search on all available package lists for the regex pattern given. 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.

    So, the rest of packages shown are because of the descriptions.

    In this case we will need to update the content to include this.

    2) In the case of:

    apt-cache pkgnames "kernel"

    It will show all the packages that starts with the string "kernel". You can check on this with another string, like "glibc".

    So it seems we will need to edit this as well.

    Thanks for the observations!!

    Luis.

Answers

Categories

Upcoming Training