Score:3

Difference between `apt search` and `apt list`?

in flag

I thought apt list was for installed packages, but looks like it needs the --installed flag for that. So what is the difference between it and apt search. Is the former only looking in a local cache of available packages?

Score:5
in flag

This is where the manual is useful:

apt search {criteria}

    search can be used to search for the given regex(7) term(s) in the list of available
    packages and display matches. This can e.g. be useful if you are looking for packages
    having a specific feature. If you are looking for a package including a specific file
    try apt-file.
apt list {criteria}

   list is somewhat similar to dpkg-query --list in that it can display a list of
   packages satisfying certain criteria. It supports glob(7) patterns for matching
   package names as well as options to list installed (--installed), upgradeable
   (--upgradeable) or all available (--all-versions) versions.

In plain English, with apt search {criteria} you can find packages that meet the criteria you set in their names, descriptions, or other metadata.

apt list {criteria}, however, gives you the option to list packages based on their names and whether they are already installed, currently upgradable, or simply exist (in your local copy of the package list cache).

user535733 avatar
cn flag
I think of `search` as "to find packages that I DON'T know the name of," and of `list` as "to find *the status* of packages that I DO know the name of"
alchemy avatar
in flag
Thanks, so search can use regex.. and also some way to search features, I wonder how that works. And list uses regular wildcards and readable flag options for filtering.
alchemy avatar
in flag
@user535733, interesting perspective.. it actually came up in the context of using `apt list` to pipe into xargs for me. It could be used that way though. I think dpkg -l | grep <name> would give you more info though.. yeah, without extra flags, I dont get any status info about a package.. the --help info doesnt offer any status flags, it just says: "list - list packages based on package names.. search - search in package descriptions".. which goes back to the searchablility of features, which they must mean is in the descriptions. So name vs description basically, and then regex vs wildcards
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.