21

Can anyone please define what exactly the APT cache is?

steabert
  • 1,776
  • 10
  • 12
Arun
  • 211
  • 1
  • 2
  • 3
  • 3
    [`apt-cache`'s manual](http://manpages.ubuntu.com/manpages/precise/en/man8/apt-cache.8.html), maybe this can help out a bit, while waiting for someone to give you a better answer? – Dan Aug 27 '12 at 13:56
  • Are you referring to the terminal command 'apt-cache'? – loklaan Aug 27 '12 at 14:00
  • The heading says `apt-cache` and not "APT cache", then also there's the `command-line` tag and also the only question to date which describes the command is almost as much upvoted as the question, so I must suppose the question refers to the command. But what is the "APT cache" used for? That's a very legit question. I asked it [here](https://askubuntu.com/questions/1321028/whats-the-point-of-keeping-packages-in-apt-cache). – Martin Andersson Mar 04 '21 at 09:56

1 Answers1

19

apt-cache is a command to manipulate and obtain information from the packages at apt's cache.

It creates a repository of information about the packages that are avaiable from your sources list, so this way you can search packages and information about it.

Let's say you want to install a chat program but you don't know the name of a package for it.

You would open a console and type:

sudo apt-cache search chat

This would return a list of packages available and that refer to the word chat.

Typical operations with apt-cache:

apt-cache add

Adds a package file to the source cache.

apt-cache gencaches

Builds both the package and source cache

apt-cache showpkg

Show some general information for a single package

apt-cache stats

Show some basic statistics

apt-cache dump

Show the entire file in a terse form

apt-cache dumpavail

Print an available file to stdout

apt-cache unmet

Show unmet dependencies

apt-cache check

Check the cache a bit

apt-cache search

Search the package list for a regex pattern

apt-cache show

Show a readable record for the package

apt-cache depends

Show raw dependency information for a package

apt-cache pkgnames

List the names of all packages

apt-cache dotty

Generate package graphs for GraphVis

Don't forget to add package name after the commands listed above.

Source1

Source2

LnxSlck
  • 12,146
  • 1
  • 41
  • 51