oh-my-zsh

安装,使用 zsh:

使用 oh-my-zsh 需先安装 zsh (v4.3.9 或更高)

查看是否已安装 zsh
cat /etc/shells
# 或
zsh -version
安装 zsh
# Linux - Fedora / RedHat / SUSE
sodu yum install zsh

# Linux - Debian / Ubuntu
sodu apt-get install zsh

# MacOS
brew install zsh
默认 shell 使用 zsh
chsh -s $(which zsh)

# 确认设置是否成功
echo $SHELL

安装 oh-my-zsh:

Method Command
curl sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"
wget sh -c "$(wget -O- https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"
fetch sh -c "$(fetch -o - https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"
See Also:

更新 oh-my-zsh: omz update


使用插件:

* zsh-syntax-highlighting

命令太多,有时候记不住,等输入完了才知道命令输错了,这个插件直接在输入过程中就会提示你,当前命令是否正确,错误显示红色,正确显示绿色。

# 安装
git clone git://github.com/zsh-users/zsh-syntax-highlighting $ZSH_CUSTOM/plugins/zsh-syntax-highlighting

vi ~/.zshrc
# 在文件里找到 plugins,添加插件名称
plugins=(
  git
  zsh-syntax-highlighting
)

# 让修改生效
source ~/.zshrc
* zsh-autosuggestions

该插件会记录你之前输入过的所有命令,并且自动匹配你可能想要输入命令,然后按 → 补全。

# 安装
git clone git://github.com/zsh-users/zsh-autosuggestions $ZSH_CUSTOM/plugins/zsh-autosuggestions

vi ~/.zshrc
# 在文件里找到 plugins,添加插件名称
plugins=(
  git
  zsh-syntax-highlighting
  zsh-autosuggestions
)

# 让修改生效
source ~/.zshrc
* extract

提供一个 extract 命令,以及它的别名 x。功能是:一键解压

vi ~/.zshrc
# 在文件里找到 plugins,添加插件名称
plugins=(
  git
  zsh-syntax-highlighting
  zsh-autosuggestions
  extract
)

# 让修改生效
source ~/.zshrc
See Also:

修改主题:

修改 ~/.zshrc 文件中 ZSH_THEME 的值即可。

See Also:
Copyright © 2025 LOLO