配置oh-my-zsh
- 查看當前shell
- 安裝zsh
- 切換到zsh
- 配置ohmysh
查看當前shell
cat /etc/shells
# /etc/shells: valid login shells
/bin/sh
/bin/bash
/usr/bin/bash
/bin/rbash
/usr/bin/rbash
/bin/dash
/usr/bin/dash
安裝zsh
sudo apt install zsh
# /etc/shells: valid login shells
/bin/sh
/bin/bash
/usr/bin/bash
/bin/rbash
/usr/bin/rbash
/bin/dash
/usr/bin/dash
/bin/zsh
/usr/bin/zsh
切換到zsh
chsh -s /bin/zsh
為特定用戶設置默認 shell
sudo chsh -s /bin/zsh <username>
# <username> 替換為實際用戶名
配置ohmysh
- 下載zsh
git clone https://github.com/ohmyzsh/ohmyzsh.git ~/.oh-my-zsh
- [optional] 備份~/.zshrc
cp ~/.zshrc ~/.zshrc.orig
- 復制模板中的zsh
cp ~/.oh-my-zsh/templates/zshrc.zsh-template ~/.zshrc
- 可選的插件
建議安裝,大大提升使用體驗,代碼自動補全和命令行高亮
git clone https://github.com/zsh-users/zsh-autosuggestions.git ~/.oh-my-zsh/plugins/zsh-autosuggestionsgit clone https://github.com/zsh-users/zsh-syntax-highlighting.git ~/.oh-my-zsh/plugins/zsh-syntax-highlighting
vim ~/.zshrc
把插件名稱加入其中
plugins=(gitzsh-autosuggestionszsh-syntax-highlighting)
保存退出
source ~/.zshrc