快轉到主要內容

如何在 ZSH 遇到 Command not found 時顯示安裝提示?

·248 字· loading · loading ·
目錄
讓你的 ZSH 也可以貼心的提示指令安裝包怎麼下載。

找不到指令時,提示安裝套件
#

原始的 ZSH 在找不到指令時只會顯示:

1> curl
2curl: command not found

讓它變成更人性化的提示:

1> curl
2Command 'curl' not found, did you mean:
3  command 'curl' from snap curl (8.19.0)
4  command 'curl' from deb curl (8.5.0-2ubuntu10.8)

Install command-not-found package
#

1sudo apt install command-not-found

Edit config file to auto load
#

1echo "source /etc/zsh_command_not_found" >> ~/.zshrc

Reload current session
#

1exec zsh

References
#

Alpaca
作者
Alpaca
No one can stop my feet.

相關文章