Answers:
外壳不仅可以查看$PATH
。如果未找到命令,command_not_found_handle
则执行bash函数,然后依次调用python脚本/usr/lib/command-not-found
。这会在程序包列表中搜索应安装的程序,此命令才能正常运行。如果您知道拼写错误,只需按Ctrl+ C即可中止搜索过程。
拼写错误的有用消息示例:
$ aptget update
No command 'aptget' found, did you mean:
Command 'apt-get' from package 'apt' (main)
aptget: command not found
缺少包的有用消息示例:
$ deja-dup
The program 'deja-dup' is currently not installed. You can install it by typing:
sudo apt-get install deja-dup
另请参阅其背后的原理,https://wiki.ubuntu.com/CommandNotFoundMagic