ubuntu查询相关库的情况

查询一个库的位置

环境: Ubuntu 18.04.1 LTS

  • 测试库名: libmpfr

库的相关描述

1
$dpkg -l "*库信息*"

示例:

1
2
3
4
5
6
7
$dpkg -l "*libmpfr*"
Desired=Unknown/Install/Remove/Purge/Hold
| Status=Not/Inst/Conf-files/Unpacked/halF-conf/Half-inst/trig-aWait/Trig-pend
|/ Err?=(none)/Reinst-required (Status,Err: uppercase=bad)
||/ Name Version Architecture Description
+++-========================================-=========================-=========================-======================================================================================
ii libmpfr6:amd64 4.0.1-1 amd64 multiple precision floating-point computation

库的位置

查询libmpfr的路径

直接查找

1
$ldconfig -p | grep "库信息"

示例:

1
2
$ldconfig -p | grep "libmpfr"
libmpfr.so.6 (libc6,x86-64) => /usr/lib/x86_64-linux-gnu/libmpfr.so.6

间接查找

1
dpkg -L "库名称"

示例:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
$dpkg -L "libmpfr6:amd64"
/.
/usr
/usr/lib
/usr/lib/x86_64-linux-gnu
/usr/lib/x86_64-linux-gnu/libmpfr.so.6.0.1
/usr/share
/usr/share/doc
/usr/share/doc/libmpfr6
/usr/share/doc/libmpfr6/AUTHORS
/usr/share/doc/libmpfr6/BUGS
/usr/share/doc/libmpfr6/NEWS.gz
/usr/share/doc/libmpfr6/README
/usr/share/doc/libmpfr6/TODO.gz
/usr/share/doc/libmpfr6/changelog.Debian.gz
/usr/share/doc/libmpfr6/copyright
/usr/lib/x86_64-linux-gnu/libmpfr.so.6