117 字
1 分钟
Ubuntu 安装 zsh

安装 zsh#

Terminal window
sudo apt-get install zsh -y

查看系统自带的 shell#

Terminal window
vps-2bc29f89% cat /etc/shells
# /etc/shells: valid login shells
/bin/sh
/usr/bin/sh
/bin/bash
/usr/bin/bash
/bin/rbash
/usr/bin/rbash
/usr/bin/dash
/usr/bin/screen
/usr/bin/tmux
/bin/zsh
/usr/bin/zsh
/usr/bin/zsh

将 zsh 设置为默认的 shell#

Terminal window
sudo chsh -s /usr/bin/zsh $USER

使用以上命令,可以避免使用证书登录而无法输入密码的情况。


安装插件#

Terminal window
sudo apt-get install -y zsh-autosuggestions zsh-syntax-highlighting command-not-found

配置~/.zshrc

Terminal window
# command_not_found
source /etc/zsh_command_not_found
# completion
autoload -Uz compinit
compinit
# better completion menu
zstyle ':completion:*' menu select
zstyle ':completion:*' matcher-list 'm:{a-zA-Z}={A-Za-z}'
# autosuggestions
source /usr/share/zsh-autosuggestions/zsh-autosuggestions.zsh
# syntax highlighting
source /usr/share/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh
Ubuntu 安装 zsh
https://blog.echopath.one/posts/install-zsh-on-ubuntu/
作者
Lucien Noir
发布于
2026-04-16
许可协议
CC BY-NC-SA 4.0