快轉到主要內容

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

·248 字· loading · loading ·
Computer-Science ZSH
目錄
讓你的 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.

相關文章

Ubuntu 睡眠(Suspend)、休眠(Hibernate) 差別,及啟用休眠的方式
·1625 字· loading · loading
Computer-Science Ubuntu Hibernate
讓電腦可以不消耗電力的存放記憶體的狀態,下次開機將會接續上次的工作進度。
Git log 中文亂碼?
·504 字· loading · loading
Computer-Science Git
某些環境不支援顯示中文的 git log,其實只要修改系統的語系即可。
LVM 邏輯卷管理(Logical Volume Manager)
·1369 字· loading · loading
Computer-Science LVM
比傳統硬碟分割更有效的硬碟管理方式。
Ubuntu 安裝 Fcitx5 注音輸入,並解決無法在瀏覽器切換輸入法的問題
·436 字· loading · loading
Computer-Science Ubuntu Fcitx
Ubuntu 安裝 Fcitx5 遇到困難,甚至無法於瀏覽器切換輸入法嗎?
How to change password of Mariadb?
·63 字· loading · loading
Computer-Science Mariadb
移動 WSL 的儲存空間到其他硬碟
·1041 字· loading · loading
Computer-Science WSL
Windows 的 WSL 佔用了太多系統空間,本文將介紹如何將其移動至自訂的硬碟位置。