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.

  • packages
  • files

Steps

  1. command -v ls

    the file a command runs, to ask about

  2. dpkg -S /usr/bin/ls

    the package that installed it (Debian, Ubuntu)

  3. rpm -qf /usr/bin/ls

    the same on Fedora, RHEL and openSUSE

  4. pacman -Qo /usr/bin/ls

    the same on Arch

  5. apt-file search bin/ncdu

    the package that would install a file not here yet (Debian, Ubuntu; needs apt-file)

  6. 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

  • dpkg
  • rpm
  • pacman
  • apt-file

Each has a page in lore: lore dpkg opens it.