Useful debian command: apt-file

In later versions of debian-based systems ¬†there’s a command named “apt-file”, it is used to determine which installation package a certain file can be found in.

This can for example be used when something is missing when you compile from source. It may look as follows:

The compilation failed because the file “raster.h” could not be found. The file is probably missing ¬†and something needs to be installed for it to be put in place. The question then is what is to be installed.
An easy way to determine this is to use the command “apt-file“.

Before running the command it is a good idea to update its database.

Then use the command to search for the missing file.

apt-file lists the packages that substantive set the requested file:

Then you only need to install the desired package and try to compile again. In this case, two different packages that contain the requested file was listed, it should be enough to install one of them.



If you get

when running the “apt-file” command, simply install it by entering:


Have fun!

1 comment for “Useful debian command: apt-file

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.