隨著 AI 技術和雲原生開發的快速發展,命令列工具也在不斷進化。2026 年,我們迎來了新一代的 CLI 工具,它們不僅保持了傳統 Unix 哲學的簡潔高效,還融入了 AI 輔助、智慧補全和現代化互動體驗。
本文將介紹 7 款在 2026 年最值得開發者關注的現代 CLI 工具,幫助你大幅提升終端工作效率。
1. Zsh + Oh My Zsh - 智慧 Shell 框架
雖然 Zsh 不是新工具,但配合 Oh My Zsh 的現代化配置,它仍然是 2026 年最流行的 Shell 選擇。
核心特性: - 智慧自動補全 - 語法標示 - 豐富的插件生態系統 - 主題客製化
安裝指令:
# Ubuntu/Debian
sudo apt update && sudo apt install zsh -y
# 安裝 Oh My Zsh
sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"
# 推薦插件
git clone https://github.com/zsh-users/zsh-autosuggestions ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-autosuggestions
git clone https://github.com/zsh-users/zsh-syntax-highlighting ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-syntax-highlighting
配置範例(~/.zshrc):
plugins=(git zsh-autosuggestions zsh-syntax-highlighting)
ZSH_THEME="powerlevel10k/powerlevel10k"
2. Yazi - 極速終端檔案管理器
Yazi 是用 Rust 編寫的現代終端檔案管理器,速度極快且支援圖片預覽。
核心特性: - 非同步 I/O,操作流暢 - 內建圖片預覽 - Vim 風格快捷鍵 - 支援自訂插件
安裝指令:
# 使用 Cargo(推薦)
cargo install yazi-fm yazi-cli
# 或使用套件管理器
# Ubuntu/Debian(需要新增 PPA)
sudo add-apt-repository ppa:xyzen/yazi
sudo apt update && sudo apt install yazi -y
# Arch Linux
yay -S yazi
快速上手:
# 啟動 Yazi
yazi
# 常用快捷鍵
# k/j - 上下移動
# h/l - 進入/退出目錄
# o - 開啟檔案
# dd - 刪除檔案
# yy - 複製檔案
# pp - 貼上檔案
GitHub: https://github.com/sxyazi/yazi
3. Fzf - 模糊查找神器
Fzf 是通用的命令列模糊查找工具,可以與任何指令結合使用。
核心特性: - 即時模糊搜尋 - 與歷史指令整合 - 檔案、目錄、處理程序快速查找 - 高度可客製
安裝指令:
# Ubuntu/Debian
sudo apt install fzf -y
# macOS
brew install fzf
# 或使用 git
git clone --depth 1 https://github.com/junegunn/fzf.git ~/.fzf
~/.fzf/install
實用技巧:
# 搜尋歷史指令
Ctrl + R
# 查找並開啟檔案
vim $(fzf)
# 查找目錄並進入
cd $(find . -type d | fzf)
# 結合 grep 使用
grep -r "pattern" $(fzf)
GitHub: https://github.com/junegunn/fzf
4. Bat - 帶語法標示的 cat
Bat 是 cat 指令的現代替代品,內建語法標示和 Git 整合。
核心特性: - 自動語法標示 - Git 變更顯示 - 行號顯示 - 自動分頁
安裝指令:
# Ubuntu/Debian
sudo apt install bat -y
# 建立別名
alias bat='batcat'
# macOS
brew install bat
# 或使用 Cargo
cargo install bat
使用範例:
# 檢視檔案(帶標示)
bat main.py
# 顯示所有行號
bat -n main.py
# 顯示 Git 變更
bat main.py
# 檢視多個檔案
bat *.rs
GitHub: https://github.com/sharkdp/bat
5. Tmux - 終端複用器
Tmux 允許你在單個視窗中執行多個終端工作階段,是遠端開發和長時間任務的必備工具。
核心特性: - 工作階段持久化 - 多視窗/面板管理 - 支援遠端協作 - 豐富的插件生態
安裝指令:
# Ubuntu/Debian
sudo apt install tmux -y
# macOS
brew install tmux
# Arch Linux
sudo pacman -S tmux
常用快捷鍵(前綴鍵:Ctrl+b):
# 工作階段管理
Ctrl+b c # 建立新視窗
Ctrl+b n # 下一個視窗
Ctrl+b p # 上一個視窗
Ctrl+b d # 分離工作階段
# 面板管理
Ctrl+b % # 垂直分割
Ctrl+b " # 水平分割
Ctrl+b 方向鍵 # 切換面板
Ctrl+b x # 關閉面板
# 重新連接工作階段
tmux attach -t [工作階段名]
推薦配置(~/.tmux.conf):
# 設定前綴鍵為 Ctrl+a
set -g prefix C-a
unbind C-b
bind C-a send-prefix
# 滑鼠支援
set -g mouse on
# 歷史行數
set -g history-limit 10000
# 狀態列
set -g status-bg colour236
set -g status-fg white
6. Htop - 互動式處理程序檢視器
Htop 是 top 指令的增強版,提供更直覺的處理程序管理和系統監控。
核心特性: - 彩色顯示 - 垂直/水平捲動 - 快速結束/重新調整處理程序 - 樹狀視圖顯示處理程序關係
安裝指令:
# Ubuntu/Debian
sudo apt install htop -y
# macOS
brew install htop
# Arch Linux
sudo pacman -S htop
使用技巧:
# 啟動 htop
htop
# 按 CPU 排序
F6 → PERCENT_CPU
# 按記憶體排序
F6 → PERCENT_MEM
# 搜尋處理程序
F3 → 輸入處理程序名
# 結束處理程序
F9 → 選擇訊號
# 樹狀視圖
F5
GitHub: https://github.com/htop-dev/htop
7. Starship - 跨 Shell 提示字元
Starship 是一個極簡、快速、可高度客製的 Shell 提示字元,支援所有主流 Shell。
核心特性: - 跨平台(Bash、Zsh、Fish、PowerShell 等) - 自動顯示專案資訊(Git、Node.js、Python 等) - 極速渲染 - 豐富的自訂選項
安裝指令:
# 通用安裝腳本
curl -sS https://starship.rs/install.sh | sh
# 或使用套件管理器
# Ubuntu/Debian(需要新增儲存庫)
curl -sS https://starship.rs/install.sh | sh
# macOS
brew install starship
# Arch Linux
yay -S starship
配置(新增到 ~/.zshrc 或 ~/.bashrc):
eval "$(starship init zsh)" # 或 bash
自訂配置(~/.config/starship.toml):
[character]
success_symbol = "[➜](bold green)"
error_symbol = "[✗](bold red)"
[git_branch]
symbol = "🌱 "
truncation_length = 4
truncation_symbol = ""
[git_status]
ahead = "⇡${count}"
diverged = "⇕⇡${ahead_count}⇣${behind_count}"
behind = "⇣${count}"
[package]
symbol = "📦 "
[python]
symbol = "🐍 "
總結
這 7 款 CLI 工具代表了 2026 年終端開發的最佳實踐:
| 工具 | 用途 | 學習曲線 |
|---|---|---|
| Zsh + Oh My Zsh | Shell 增強 | 低 |
| Yazi | 檔案管理 | 中 |
| Fzf | 模糊查找 | 低 |
| Bat | 檔案檢視 | 低 |
| Tmux | 終端複用 | 中 |
| Htop | 處理程序監控 | 低 |
| Starship | 提示字元美化 | 低 |
建議的安裝順序: 1. 先安裝 Zsh + Oh My Zsh 和 Starship,改善基礎體驗 2. 安裝 Fzf 和 Bat,提升日常操作效率 3. 配置 Tmux,應對複雜開發場景 4. 嘗試 Yazi 和 Htop,探索更多可能性
這些工具都是開源且免費的,大部分可以透過系統套件管理器一鍵安裝。開始使用它們,讓你的終端工作效率提升一個台階!
參考資料: