pkgfile (简体中文)
工具pkgfile可以查出文件是由哪一个包提供的。
Contents
安装
可以从 官方软件仓库 安装软件包pkgfile , 或者从 AUR 安装 pkgfile-gitAUR。
然后以 root 权限更新文件数据库:
# pkgfile --update
示例
查找哪个包包含名为 "makepkg" 的文件:
$ pkgfile makepkg
core/pacman #搜索的文件在 [core] 源的 pacman 包中。
其它示例
列出 [core] 源中 archlinux-keyring 包包含的文件:
$ pkgfile --list core/archlinux-keyring
core/archlinux-keyring usr/ core/archlinux-keyring usr/share/ core/archlinux-keyring usr/share/pacman/ core/archlinux-keyring usr/share/pacman/keyrings/ core/archlinux-keyring usr/share/pacman/keyrings/archlinux-revoked core/archlinux-keyring usr/share/pacman/keyrings/archlinux-trusted core/archlinux-keyring usr/share/pacman/keyrings/archlinux.gpg
"Command not found" 钩子
pkgfile 包含一个叫做 "command not found" 的钩子,它会在你键入一个未知命令的时候自动在官方源中搜索。
要在所有的shell中启用它,需要将钩子的 source 添加到你的 shell 的配置文件中。
- 在 Bash 中启用:
~/.bashrc
source /usr/share/doc/pkgfile/command-not-found.bash
- 在 Zsh 中启用:
~/.zshrc
source /usr/share/doc/pkgfile/command-not-found.zsh
参阅
- Bash#The_"command_not_found"_hook[broken link: invalid section] - A section comparing pkgfile and command-not-foundAUR