The files in the directory are package archives. The program appears in the system once the package is installed.
On Ubuntu, programs are installed as packages. A package comes as an archive with the .deb extension: inside are the program's files and a description — the name, the version and the other packages the program cannot work without.
While the archive sits in a directory, it is an ordinary file. dpkg does the installation: it places the files from the archive across the system — the program into /usr/bin, settings into /etc — and makes a record in the package database. The record keeps the name, the version and the list of installed files.
dpkg -s reads that record. Compare the lesson's package with tree, a program installed along with the system:
There is no record for lab-pkg-report: package 'lab-pkg-report' is not installed and no information is available. For tree the first lines are Package: tree and Status: install ok installed.
tree was installed from an archive in /var/cache/apt/archives, then that archive was deleted. What will dpkg -s tree print?
-
dpkg -sreads the record in the package database and never opens the archive. The record and the program files stay after the archive is deleted. -
The archive is needed only during installation.
dpkg -stakes its data from the package database.
Installation placed the tree files across the system and made a record in the package database. After that the archive is no longer needed: dpkg -s reads the record, and tree runs from /usr/bin/tree.
Key points
-
A package comes as a
.debarchive holding the program's files and its description. - Installation places the files across the system and makes a record in the package database.
-
dpkg -sreads the database record: if it is there, the package is installed.