man dpkg在没有给出filename-search-pattern的定义的情况下这么说。
-S, --search filename-search-pattern...
Search for a filename from installed packages.例如,下面的输出令人困惑。为什么通过移除前导"/",查询字符串不必以结果字符串结尾。
谁能给出filename-search-pattern的定义,这样我才能确切地知道如何使用dpkg -S进行搜索?
$ dpkg -S /bin/ls
coreutils: /bin/ls
$ dpkg -S bin/ls
kmod: /sbin/lsmod
pciutils: /usr/bin/lspci
util-linux: /bin/lsblk
util-linux: /usr/bin/lsns
usbutils: /usr/bin/lsusb
e2fsprogs: /usr/bin/lsattr
util-linux: /usr/bin/lsmem
util-linux: /usr/bin/lslogins
initramfs-tools-core: /usr/bin/lsinitramfs
util-linux: /usr/bin/lsipc
kmod: /bin/lsmod
util-linux: /usr/bin/lslocks
gnupg-utils: /usr/bin/lspgpot
lsof: /usr/bin/lsof
coreutils: /bin/ls
util-linux: /usr/bin/lscpu
klibc-utils: /usr/lib/klibc/bin/ls
lshw: /usr/bin/lshw
lsb-release: /usr/bin/lsb_release发布于 2021-02-06 16:17:30
-S选项dpkg实际上是一个dpkg-query操作,如man dpkg的ACTIONS部分所指出的:
dpkg-query actions
See dpkg-query(1) for more information about the following
actions.
-l, --list package-name-pattern...
List packages matching given pattern.
-s, --status package-name...
Report status of specified package.
-L, --listfiles package-name...
List files installed to your system from package-name.
-S, --search filename-search-pattern...
Search for a filename from installed packages.
-p, --print-avail package-name...
Display details about package-name, as found in
/var/lib/dpkg/available. Users of APT-based frontends
should use apt-cache show package-name instead.如果您按指示引用dpkg-query手册页,您应该找到以下描述:
-S, --search filename-search-pattern...
Search for packages that own files corresponding to the given
pattern. Standard shell wildcard characters can be used in the
pattern, where asterisk (*) and question mark (?) will match a
slash, and blackslash (\) will be used as an escape character.
If the first character in the filename-search-pattern is none of
‘*[?/’ then it will be considered a substring match and will be
implicitly surrounded by ‘*’ (as in *filename-search-pattern*).
If the subsequent string contains any of ‘*[?\’, then it will
handled like a glob pattern, otherwise any trailing ‘/’ or ‘/.’
will be removed and a literal path lookup will be performed.
This command will not list extra files created by maintainer
scripts, nor will it list alternatives.https://askubuntu.com/questions/1314155
复制相似问题