I have some questions about the APT package manager.
As I understand we have repositories URLs located at /etc/apt/sources.list
and /etc/apt/sources.list.d/*
When apt-get update
is called, apt tries to connect to all specified repositories in the file and download information about those repositories about what programs are available and so on.
It caches all retrieved data locally in order to use it later without making internet requests to the repository.
When apt-get install
is called it searches local cache package list from available repositories and if package is not found it does nothing except display an error.
apt-get search
also looks into local cache and doesn't make any requests to the internet.
Am I right? I am not sure about commands that make requests instead of searching data in the local cache.
Also, what is the difference between apt-cache search
and apt search
? I can guess they both use the local cache.
Best Answer
You are right that
apt-get update
reads from the sources (online) and the other commandsapt-get search
andapt-get install
read from the cached information. Fromman apt
:The difference between
apt search <package>
andapt-cache search <package>
is that the output ofapt search
is fancier (has colours, alphabetically organised, has nice line separation for easy reading) because apt is a fancy new interface. This is explained well in this answer on the difference between apt & apt-getHowever, search isn't the only thing you can do with apt-cache:
This is from the
info
page forapt-cache
apt
combines commands fromapt-get
andapt-cache
, so you can get the same or slightly fancier/tidied up output from any of theapt-cache [option] <package>
commands withapt [option] <package>
egdisplays almost exactly the same as