$ sudo apt update$ sudo apt install treeUnpacking tree (2.1.0-1) ...Setting up tree (2.1.0-1) ...$ which tree/usr/bin/treeaptdpkgPackage: treeVersion: 2.1.0-1Depends: libc6 (>= 2.34)repositoryyour diskinstalled list (dpkg)cachetree/usr/binbashyeslibc6yestreenosudo apt updatesudo apt install treewhich tree
Back: terminal, apt, dpkg. Middle: package lists, repository. Front: your diskInstalled list: one cell per package, yes or noTokens: commands, the index, a lookup, the .deb box, the program file and dpkg's recordBack: the terminal, and the two tools, apt and dpkg. Middle: the package lists and the repository. Front: your disk, with the download cache, /usr/bin and dpkg's list of installed packages. sudo apt update refreshes the lists; sudo apt install tree looks tree up, checks that its need (libc6 2.34 or newer) is met, downloads tree.deb to the cache, and dpkg unpacks it into /usr/bin and records it as installed. The example is Debian 12 ("bookworm"), where tree is version 2.1.0-1 and needs libc6 (>= 2.34). Ubuntu works the same way with its own versions. The terminal shows only the key lines apt and dpkg print.

Packages and repositories

  1. A package is one file holding a program ready to install: its files, plus a label with its name, its version and what else it needs. Debian and Ubuntu packages end in .deb, like tree_2.1.0-1_amd64.deb.

Installing tree

Using and removing

What happens

;; step 1/11 · package
package   tree_2.1.0-1_amd64.deb
  name      tree
  version   2.1.0-1
  arch      amd64  (the kind of CPU it is built for)
  needs     libc6 (>= 2.34)
  files     7, among them /usr/bin/tree

The example is Debian 12 ("bookworm"), where tree is version 2.1.0-1 and needs libc6 (>= 2.34). Ubuntu works the same way with its own versions. The terminal shows only the key lines apt and dpkg print. sudo asks for your own password and only works if your account is allowed to use it. On a fresh Debian install that may need setting up first.