Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

Development Tools

Jessica Barnett
Jessica Barnett
8,028 Points

What are Package Managers, really?

This is a very basic sort of question, but it wasn't quite clear to me in the console basics lessons.

When you enter apt-cache search PROGRAM in the terminal, what exactly is apt searching? Is it somehow searching the entire internet for packages? Or does it have a database of commonly-used programs that it's looking through?

Put more simply, what exactly is a package manager? I get that it handles updates/dependencies/uninstalling, but other than that... I really don't know. It seems like there's a lot more to it. Or maybe I'm wrong?

Any thoughts?

3 Answers

James Barnett
James Barnett
39,199 Points

Let's define our terms:

  • dpkg: installs / uninstalls / verifies file in intact
  • apt-get: dependency resolution / downloads required packages from repositories (repo) / verifies package is digitally signed
  • sources.list: Where apt-get looks to find the location on the internet of the repos
  • apt-cache: A local database of containing info about the packages available on repos listed on sources.list

How does this work?

  • dpkg & apt-get they handle downloading/installing/uninstalling/dependencies/updates
  • The other half of the system is the debian archive it's basically like an app store for debian.

The real value here is the debian archive which provides makes sure there's a centralized place to look for new packages & updates and makes sure that those packages are safe to uninstall. It's basically the app for debian.

You can think of apt-cache as linking these 2 parts together.


Ubuntu (which is used in the Treehouse course) is debian-based they use most of debians, some packages are modified and some of their own creation so ubuntu operates it's own archive.

Jessica Barnett
Jessica Barnett
8,028 Points

Thank you both for the detailed answers and the extra resources. That definitely helps me understand it. Thanks for your time!

Kazimierz Matan
Kazimierz Matan
13,257 Points

What is apt searching:

*APT relies on the concept of repositories in order to find software and resolve dependencies. For apt, a repository is a directory containing packages along with an index file. This can be specified as a networked or CDROM location. The Debian project keeps a central repository of over 25,000 software packages ready for download and installation.

Any number of additional repositories can be added to APT's sources.list configuration file (/etc/apt/sources.list) and then be queried by APT. Graphical front-ends often allow modifying sources.list more simply (apt-setup). Once a package repository has been specified (like during the system installation), packages in that repository can be installed without specifying a source and will be kept up-to-date automatically.* This citation comes from Wikipedia article about apt.

So, apt searches the repository (predefined or user-updated list of software sources).

What more can it do:

apt-get cheat-sheet