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: dpkg -S finds the apt package that owns a file on disk

Apt
~/tips/tip-apt-dpkg-s-file-owner

dpkg -S /usr/bin/dig

Tells you which installed package a given file belongs to.

I come across a file in /usr/bin or /etc and wonder where it came from. dpkg keeps that record.

dpkg -S /usr/bin/dig
dpkg -S $(which crontab)

dpkg -S (search) prints the installed package that owns the path, in the form package: /path. It only knows about packages that are installed, so use apt-file for the others. If it finds nothing, the file was created by a script, built from source or installed by another tool. Give the full path as the system lists it, because the search compares file names as dpkg recorded them.

Further reading: dpkg 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