What is the snap equivalent to issuing

apt-file search X11/extensions/XKBrules.h # header file some repo uses who's compile fails as it cannot find this file

# ... above returns with

libxkbfile-dev: /usr/include/X11/extensions/XKBrules.h

above lets me identify which Ubuntu package libxkbfile-dev contains file /usr/include/X11/extensions/XKBrules.h

beauty of above is it searches ALL packages not just those already installed

How to identify which snap package contains a given filename ? ( even when I am yet to install that snap package )

On a new machine in order for above apt-file to work machine must have following run to install the latest index of all Ubuntu packages

sudo apt install apt-file -y  && sudo apt-file update

I am looking for the functional equivalent to this for snap packages

... Why ? a common use case is : if I am compiling someone else's code and a header file is missing so I need to know what package to install to get that missing header ( assuming that missing file actually lives in a package which it often does for Ubuntu packages and will increasingly do as projects migrate over to snap )

2 Answers 2


I have reported two relevant bugs in 2018:

and both are marked as WishList so this functionality is not yet implemented.

Theoretically the command-not-found may help finding relevant snap name with known executable, but I do not know yet how to automate it.

  • cool ... I up marked both tickets to encourage someone to solve this Jul 9, 2020 at 17:28

dpkg --listfiles <pkg> (-L) seems to work on Snaps too. It can reverse search the package from a file with dpkg -S <file>.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.