編輯 ~/.bashrc,新增:
echo "Did you know that: "
whatis $(ls /bin | shuf -n 1)
進階版(需安裝 cowsay):
cowsay -f $(ls /usr/share/cowsay/cows | shuf -n 1 | cut -d. -f1) \
$(whatis $(ls /bin) 2>/dev/null | shuf -n 1)
每次開啟終端隨機學習一個指令用法。
whatis 快速查詢whatis sudo yum install cheese
# 輸出:
# sudo (8) - execute a command as another user
# yum (8) - package manager
# install (1) - install package
# cheese (1) - webcam application
在複雜命令前加 whatis 即可拆解各組件功能。
# 完整手冊(支援翻頁、搜尋)
man cp
# 快速摘要(直接輸出到終端)
cp --help
習慣先看 --help 確認參數,再用 man 深入理解。
[sudo] 程式 [參數...] [選項...] [選項參數...]
# 範例拆解
sudo yum install cheese -y
│ │ │ │ │
│ │ │ │ └─ 選項參數:-y (自動回答 yes)
│ │ │ └─ 選項/旗標:-y
│ │ └─ 參數:cheese (套件名)
│ └─ 參數:install (子命令)
└─ 程式:yum (套件管理器)
/usr/bin、/bin 等 PATH 目錄-h, -v, -y)-f file.txt, --port=8080)whatis + man 理解/usr/share/doc 下工具提供的範例腳本