Packages
Upgrade a package
Probably with
$ sudo apt-get install --only-upgrade PACKAGE-NAME
Search for a package
apt-cache search something
apt search something
apt-cache pkgnames something
apt-file search regex
Find packages that contain a given file (here:
/usr/bin/lspci
). The following command uses the
-x
option to specify a regular expression (which explains why the searched file name is embedded in
^…$
).
$ apt-file search -x '^/usr/bin/lspci$'
pciutils: /usr/bin/lspci
The command's output indicates that the package pciutils
contains the file.
Show files of a package
Similarly, the files contained in a package can be shown with apt-file show
:
$ apt-file show pciutils
pciutils: /usr/bin/lspci
pciutils: /usr/bin/setpci
pciutils: /usr/sbin/update-pciids
pciutils: /usr/share/doc/pciutils/README.gz
pciutils: /usr/share/doc/pciutils/changelog.Debian.gz
…
Get package records (Description, maintainer, homepage section etc.)
$ apt-cache show pciutils
Dependencies
Forward dependencies (aka normal dependencies) denote the packages upon which a given package depends.
Reverse dependencies are the set of packages which depend on a given package.
Thus, when installing a package, its forward dependencies must be satisified.
Depdencies can be shown with
Binary vs source packages
There are two types of packages:
- binary packages
- source package
The content of a binary package is installed into a canonical location.
In contract, a source package is «installed» into an arbitrary directory.
Commands related to
binary packages include
Find out the URL of a package
$ sudo /usr/lib/apt-move/fetch -t apt-move
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
http://deb.debian.org/debian/pool/main/a/apt-move/apt-move_4.2.27-6_amd64.deb
If a package is not installed, the URL is also printed with the following command. Note: its --print-uris
, not --print-urls
!
$ apt-get install --print-uris python3-asciitree
Package cache
The package cache is an database that stores information about all available packages.
The package cache can be queried with apt-cache
.