pkgfile (简体中文)

From ArchWiki
Revision as of 03:19, 15 June 2013 by Fengchao (Talk | contribs) (Fix category. See Help:Category. There is an empty space missing.)

Jump to: navigation, search

pkgfile 是一个可以告知你文件是由哪一个包提供的工具。

你可以从 Official_Repositories_(简体中文) 安装 pkgfile , 或者从 AUR 安装 pkgfile-gitAUR

然后以 root 权限更新文件数据库:

# pkgfile --update

示例:

$ pkgfile makepkg     #查找哪个包包含名为 "makepkg" 的文件。
core/pacman           #搜索的文件在 [core] 源的 pacman 包中。

其它示例:

$ pkgfile --list core/archlinux-keyring     #列出 [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

另可参阅