安装插件
首先安装两个插件
1 2
| brew install cowsay brew install fortune
|
执行命令
就会得到如下的效果

修改知识库
默认情况下是英语,可以调整它的🧀知识库。github上有开源的知识库:https://github.com/ruanyf/fortunes
先将知识库克隆下来:git clone https://github.com/ruanyf/fortunes.git
用strfile为知识库文件创建索引文件
1 2 3 4 5
| strfile fortunes/data/fortunes strfile fortunes/data/chinese strfile fortunes/data/tang300 strfile fortunes/data/song100 strfile fortunes/data/diet
|
默认知识库的位置:/usr/local/share/games/fortunes
,可以选择清空默认的数据库,我清空了
将上面的知识库文件拷贝过来
1
| cp fortunes/data/* /usr/local/share/games/fortunes/
|
测试
1 2 3 4 5 6 7 8 9 10 11 12
| ❯ fortune | cowsay _________________________________________ / 心事浩茫连广宇,于无声处听 \ | 惊雷。 | | | \ - 鲁讯 / ----------------------------------------- \ ^__^ \ (oo)\_______ (__)\ )\/\ ||----w | || ||
|
配合 On My Zsh
在 .zshrc 配置文件中,追加
刷新配置
使用Powerlevel10k主题的话每次启动会提示
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38
| [WARNING]: Console output during zsh initialization detected.
When using Powerlevel10k with instant prompt, console output during zsh initialization may indicate issues.
You can:
- Recommended: Change ~/.zshrc so that it does not perform console I/O after the instant prompt preamble. See the link below for details.
* You will not see this error message again. * Zsh will start quickly and prompt will update smoothly.
- Suppress this warning either by running p10k configure or by manually defining the following parameter:
typeset -g POWERLEVEL9K_INSTANT_PROMPT=quiet
* You will not see this error message again. * Zsh will start quickly but prompt will jump down after initialization.
- Disable instant prompt either by running p10k configure or by manually defining the following parameter:
typeset -g POWERLEVEL9K_INSTANT_PROMPT=off
* You will not see this error message again. * Zsh will start slowly.
- Do nothing.
* You will see this error message every time you start zsh. * Zsh will start quickly but prompt will jump down after initialization.
For details, see: https://github.com/romkatv/powerlevel10k/blob/master/README.md
-- console output produced during zsh initialization follows --
|
重新配置主题
到下面这一步「Instant Prompt Mode」的时候选择Off
! 即可。

附:终端自定义 banner
修改/etc/motd
这个文件 。(motd 是message of the day的缩写,意思是“当天的提示信息”,通常在用户成功登录后出现,该信息可以从/etc/motd文本文件中找到)
1 2 3 4 5 6 7 8 9 10 11 12 13
| へ /| /\7 ∠_/ / │ / / │ Z _,< / /`ヽ │ ヽ / 〉 Y ` / / イ● 、 ● ⊂⊃〈 / () v | \〈 >ー 、_ ィ │ // / へ / ノ<| \\ ヽ_ノ (_/ │// 7 |/ >―r ̄ ̄`ー―_- Hello World! Good good study ,day day up!
|
效果:
1 2 3 4 5 6 7 8 9 10 11 12 13 14
| Last login: 21:44:09 on ttys000 へ /| /\7 ∠_/ / │ / / │ Z _,< / /`ヽ │ ヽ / 〉 Y ` / / イ● 、 ● ⊂⊃〈 / () v | \〈 >ー 、_ ィ │ // / へ / ノ<| \\ ヽ_ノ (_/ │// 7 |/ >―r ̄ ̄`ー―_- Hello World! Good good study ,day day up!
|