which package a file came from
Find the package that installed a file or a command, or the one that would install a file you do not have yet.
Steps
-
command -v lsthe file a command runs, to ask about
-
dpkg -S /usr/bin/lsthe package that installed it (Debian, Ubuntu)
-
rpm -qf /usr/bin/lsthe same on Fedora, RHEL and openSUSE
-
pacman -Qo /usr/bin/lsthe same on Arch
-
apt-file search bin/ncduthe package that would install a file not here yet (Debian, Ubuntu; needs apt-file)
-
dnf provides '*/bin/ncdu'the same on Fedora and RHEL
Notes
- Every page in lore shows its command's package under VERSION, found the same way.
- macOS: Homebrew's commands are links into its folder:
ls -l "$(command -v rg)"shows the formula.
Commands used
dpkgrpmpacmanapt-file
Each has a page in lore: lore dpkg opens it.
Related recipes
- add to the end of a fileAdd lines to a file without replacing it, also to a file only root can write.
- argument list too long"Argument list too long" from rm, cp or mv: too many files for one command line. Hand them over in batches.
- change permissions of a folder and everything in itGive a folder, its subfolders and its files the permissions or the owner they need, without making them open to everyone.
- check a file's permissionsSee who may read, write and run a file or a folder, and why a path is refused.