在 ubuntu 中,如果我为未安装但从数据库中知道的应用程序键入命令,它会给我一条如下消息:
~ $ kate
The program 'kate' is currently not installed. You can install it by typing:
sudo apt-get install kate
有没有办法在 Arch Linux 中获取类似的消息?
答案1
正在寻找完全相同的东西,在这里找到了出色的解决方案: https://bbs.archlinux.org/viewtopic.php?pid=874678#p874678
安装 pkgtools 时,会弹出更多信息:
(2/2) installing pkgtools
- Make sure to run pkgfile --update before use
- pkgfile includes a "command not found" hook for both zsh and bash.
This will automatically run pkgfile whenever you run
a command which the shell cannot find. If you want
this functionality, set CMD_SEARCH_ENABLED to 1 in
/etc/pkgtools/pkgfile.conf (or per-user by copying
that file to ${XDG_CONFIG_HOME}/pkgtools/pkgfile.conf), then
in your current shell run:
source /etc/profile
- An entry has been placed in /etc/cron.daily to run pkgfile --update
If you do not want this functionality, set UPDATE_CRON=0 in /etc/pkgtools/pkgfile.conf
答案2
所以这似乎是 python 的一部分,在 ubuntu 中它位于:
/usr/lib64/python2.7/dist-packages/CommandNotFound/CommandNotFound.py
中的以下函数:
def advise(self, command, ignore_installed=False):
" give advice where to find the given command to stderr "
我找到了实现此功能的启动板项目:https://launchpad.net/command-not-found
希望这可以帮助