brewedbits.dev

Personal blog with guides and news on selfhosting, Linux and AI, from the Netherlands

nextDash nextdash --aboutYour bookmarks. Your terminal. checks your links knows your Docker host one container, no cloudLive demo →nextdash.cc ↗

Tip: apt-file search finds the apt package that ships a missing file

Apt
~/tips/tip-apt-apt-file-search-missing-file

sudo apt install apt-file

Finds which package provides a file, even when that package is not installed.

A build fails with a missing header or a script asks for a binary that is not installed. I need the package name, not the file.

sudo apt install apt-file
sudo apt update
apt-file search bin/dig
apt-file find zlib.h

apt-file searches the Contents indexes of your repositories, so it also finds files of packages you have not installed. The default configuration makes a plain apt update fetch those indexes, and apt-file update is only a wrapper around apt update. search and find are the same command, and the pattern must match part of a file name. Add -x to use a regular expression, which can be slow. For files of installed packages, dpkg -S is faster.

Further reading: apt-file manual page

More Apt tips sudo apt-mark minimize-manual apt list '~c' grep -E ' (install|upgrade|remove) ' /var/log/dpkg.log | tail -o Dpkg::Options::="–force-confold" upgrade sudo apt-get -d -y full-upgrade All Apt tips (42) All topics

Link