ane*_*hep 53
打开终端并尝试以下命令:
dpkg -S 'command name'
Run Code Online (Sandbox Code Playgroud)
例如: dpkg -S /bin/ls
示例输出:
coreutils: /bin/ls
Run Code Online (Sandbox Code Playgroud)
您还可以获取有关 coreutils 包的详细状态信息,输入:
dpkg -s coreutils
Run Code Online (Sandbox Code Playgroud)
示例输出:
Package: coreutils
Essential: yes
Status: install ok installed
Priority: required
Section: utils
Installed-Size: 9040
Maintainer: Ubuntu Core Developers
Architecture: i386
Version: 5.97-5.3ubuntu3
Replaces: textutils, shellutils, fileutils, stat, debianutils (<= 2.3.1), dpkg (<< 1.13.2)
Provides: textutils, shellutils, fileutils
Pre-Depends: libacl1 (>= 2.2.11-1), libc6 (>= 2.6-1), libselinux1 (>= 2.0.15)
Conflicts: stat
Description: The GNU core utilities
This package contains the essential basic system utilities.
.
Specifically, this package includes:
basename cat chgrp chmod chown chroot cksum comm cp csplit cut date dd df dir
dircolors dirname du echo env expand expr factor false fmt fold groups head
hostid id install join link ln logname ls md5sum mkdir mkfifo mknod mv nice nl
nohup od paste pathchk pinky pr printenv printf ptx pwd readlink rm rmdir
sha1sum seq shred sleep sort split stat stty sum sync tac tail tee test touch
tr true tsort tty uname unexpand uniq unlink users vdir wc who whoami yes
Original-Maintainer: Michael Stone
Run Code Online (Sandbox Code Playgroud)
Pra*_*weł 14
还有另一种方法,可能有点傻,但比以前的方法快 :) 只需错误输入命令,您就会得到正确的命令名称和它来自的包。
示例输出:
pawel@pawel-desktop:/var/www$ sfn
No command 'sfn' found, did you mean:
Command 'sn' from package 'mono-devel' (main)
Command 'sfc' from package 'syfi-bin' (universe)
Command 'svn' from package 'subversion' (main)
sfn: command not found
Run Code Online (Sandbox Code Playgroud)
根据命令名称,您可以使用“type”和“dpkg”命令来确定负责安装的软件包。例如,要找出哪个软件包安装了命令“who”,您可以在命令提示符下执行以下命令:
$ type who
who is /usr/bin/who
$ dpkg -S /usr/bin/who
coreutils: /usr/bin/who
Run Code Online (Sandbox Code Playgroud)
你也可以用一行来完成:
dpkg -S $(which command)
Run Code Online (Sandbox Code Playgroud)
例如,我想知道什么包包含ls:
dpkg -S $(which ls)
Run Code Online (Sandbox Code Playgroud)
这是输出:
coreutils: /bin/ls
Run Code Online (Sandbox Code Playgroud)
所以现在我知道 ls 命令,/bin/ls 文件,来自 coreutils 包。