我发现了一个文件(比如“badfile”),/usr/bin其中似乎不属于我系统上安装的任何软件包:
$ dpkg -S /usr/bin/badfile
dpkg-query: no path found matching pattern /usr/bin/badfile
$ apt-file search /usr/bin/badfile
# nothing is returned
Run Code Online (Sandbox Code Playgroud)
我想我想删除此文件或将其移动到/usr/local/bin. 话虽如此,大概还有其他这样的文件。有没有办法列出/usr/bin/Debianapt软件包管理器不知道的某个存储库(此处,)中的所有文件?
您可以将多个文件名传递给以一次性dpkg -S报告所有文件
例如
dpkg -S /usr/bin/* > /dev/null
Run Code Online (Sandbox Code Playgroud)
现在这并不完美;符号链接没有被正确报告
例如
dpkg-query: no path found matching pattern /usr/bin/lzdiff
Run Code Online (Sandbox Code Playgroud)
这也意味着诸如指向的指针之类的东西alternatives将被严重报告,因为它们是符号链接。
如果您想减少误报,我们可以使用find:
find /usr/bin -type f -exec dpkg -S {} + > /dev/null
Run Code Online (Sandbox Code Playgroud)
在我的 Debian Jessie 机器上,这会导致
dpkg-query: no path found matching pattern /usr/bin/flash-player-properties
Run Code Online (Sandbox Code Playgroud)