背景:
服务器上默认的 shell 实在是不好用,一些补全、高亮之类的功能一般都没有,这里介绍一个新的 shell 工具 zsh,内容包括 安装 以及 插件。
1. 环境
首先介绍两个查看命令
# 查看当前使用 shell (通常为 bash)
$ echo $SHELL
/bin/zsh
# 查看已安装的所有 shell (我的本地已经安装)
$ cat /etc/shells
# List of acceptable shells for chpass(1).
# Ftpd will not allow users to connect who are not using
# one of these shells.
/bin/bash
/bin/csh
/bin/dash
/bin/ksh
/bin/sh
/bin/tcsh
/bin/zsh
2. 安装
# apt 安装 Zsh 工具
$ sudo apt-get install -y zsh
3. 插件
插件方面推荐插件 oh-my-zsh
项目地址: https://github.com/ohmyzsh/ohmyzsh
相关的使用在里边都有介绍
# 下载并安装 oh-my-zsh
$ sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"
# 为 noone 用户切换 shell 到 zsh
$ chsh -s /bin/zsh noone
# 重新连接后即可看到
可以在 ~/.zshrc 中修改主题的相关配置,可以在 这里 查看一些主题。
同时推荐一个主题 ZSH_THEME=“ys” , 效果如下:
修改之后 source ~/.zshrc 即可看到效果
另: 需要修改一些其他配置的可以在 ~/.zshrc 中更改,也可以去 [github] (https://github.com/ohmyzsh/ohmyzsh) 中查看使用方式。