Поиск всех файлов, которые ссылаются на определенную библиотеку в Linux

294
slowpoison

Я мог бы написать сценарий для комбинации find, ldd и grep, но хотел выяснить, есть ли лучший способ.

Например, если библиотека /usr/lib/libmhash.so.2, я хотел бы знать все двоичные файлы в системе, которые ссылаются на нее.

1

1 ответ на вопрос

0
user55325

I don't know of a standard way to do that without inspecting every binary. What you can do, although it's not quite the same thing, is look at the dependency information in your package manager. If you're using a Debian-based distro, apt-cache showpkg <package> will show, among other things, "reverse dependencies" - a list of all the packages that depend on that package.

For example, the following packages depend on libmhash2 on my system:

Reverse Depends: libmhash2:i386,libmhash2 yubiserver,libmhash2 wxhexeditor,libmhash2 wit,libmhash2 vdetelweb,libmhash2 thunar-gtkhash,libmhash2 steghide,libmhash2 python-mhash-dbg,libmhash2 python-mhash,libmhash2 proxytunnel,libmhash2 passwordmaker-cli,libmhash2 nd,libmhash2 nautilus-gtkhash,libmhash2 mcrypt,libmhash2 0.8.16-1 mbuffer,libmhash2 libgringotts2,libmhash2 libcsync0,libmhash2 gtkhash,libmhash2 cd5,libmhash2 aide-dynamic,libmhash2 librasqal3,libmhash2 libmhash-dev,libmhash2 0.9.9.9-2 

Of course, this doesn't tell you about specific binaries, but it might solve your problem (or at least someone else's). If not, you can always use find/ldd/grep.

Похожие вопросы