Has it ever happened to you that you couldn't build a package because there was a missing dependence? A similar situation can occur when we want to compile a program or run a binary. In these cases, we may run into an error such as: «X file is missing, impossible to perform the requested task«.
Or worse: how to fix the classic dependency conflict: "file X is already installed«? For this it is necessary to discover which package contains the file in question. How to do it? Ha! Come in and find out ... |
A while ago we saw how to do it on Debian, Ubuntu and derivatives. Now, let's see how it is done in the rest of the distros as well.
APT: Debian, Ubuntu and derivatives
Those distros that use APT, can use apt file.
sudo apt-get install apt-file
Once installed, it runs like this:
apt-file search / path / file
Where / path / file is the path of the file you are looking for.
RPM: Red Hat, Fedora and derivatives
You only need to execute the following command:
rpm -qf / path / file
Where / path / file is the path of the file you are looking for.
Pacman: Arch and derivatives
In Arch, you only need to use the almighty Pacman:
pacman -Qo / path / file
So, for example, the command:
pacman -Qo /usr/lib/gtk-2.0/2.10.0/engines/libmist.so
Bring back:
/usr/lib/gtk-2.0/2.10.0/engines/libmist.so is owned by gtk-engines 2.20.2-1
It is also possible to use pkgfile. You only need to install it:
pacman -S pkgtools
It runs like this:
pkgfile file
Where file is the name of the file you are looking for.
Come on, it comes to me from ten (the knack of compiling) !!! Thanks and greetings !!!
You're welcome Migue! I'm glad it works.
A hug! Paul.
Good contribution. In Debian, Ubuntu and derivatives, you can also use the dpkg command with the -S option to get the same information, in case you don't want to install apt-file. Using it would be very similar to apt-file:
dpkg -S / path / file
Interesting! Thanks for the contribution!
Hug! Paul.