linux服务器初建之zsh安装

安装zsh

root下操作

安装zsh

1
yum -y install zsh

切换bash至zsh

1
2
chsh -s $(which zsh) $(whoami)
reboot

install oh-my-zsh

1
2
3
4
5
6
7
8
# if wget
sh -c "$(wget https://raw.github.com/ohmyzsh/ohmyzsh/master/tools/install.sh -O -)"

# if curl
sh -c "$(curl -fsSL https://raw.github.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"

# if your network is not fine, you can use the proxy
sh -c "$(curl -fsSLx http://www-proxy.example.com:8080 https://raw.github.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"

config

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
vim ~/.zshrc
plugins=(git z zsh-autosuggestions zsh-syntax-highlighting)
ZSH_THEME="powerlevel10k/powerlevel10k"
POWERLEVEL10K_MODE="nerdfont-complete"
# you can run the command 'p10k configure' to reconfigure your powerlevel10k

git clone https://github.com/zsh-users/zsh-autosuggestions.git \
${ZSH_CUSTOM:-$HOME/.oh-my-zsh/custom}/plugins/zsh-autosuggestions

git clone https://github.com/zsh-users/zsh-syntax-highlighting.git \
${ZSH_CUSTOM:-$HOME/.oh-my-zsh/custom}/plugins/zsh-syntax-highlighting

git clone https://github.com/romkatv/powerlevel10k.git \
${ZSH_CUSTOM:-$HOME/.oh-my-zsh/custom}/themes/powerlevel10k

fonts

You can download Meslo font from here.

Or Manually Download these four ttf files:

Double-click on each file and click “Install”. This will make MesloLGS NF font available to all applications on your system.

BTW

Tips:

fd bat and lsd are very nice.
Maybe you can install them. For more information, you can access their home page.

1
2
3
4
5
6
7
8
9
10
# install fd, bat and lsd on RHEL/CentOS
# Author="sharkdp"; Repo="fd";
# Author="sharkdp"; Repo="bat";
Author="Peltoche"; Repo="lsd"; latest_url="https://api.github.com/repos/$Author/$Repo/releases/latest"; \
V=$(curl --silent $latest_url | grep -Eo '"tag_name": "v?(.*)"' | sed -E 's/.*"([^"]+)".*/\1/'); \
Latest_tar="$Repo-$V-x86_64-unknown-linux-musl.tar.gz" \
&& curl -sOL "https://github.com/$Author/$Repo/releases/download/$V/$Latest_tar" \
&& tar xzvf $Latest_tar -C . \
&& sudo sh -c "cp ./$Repo-$V-x86_64-unknown-linux-musl/$Repo /usr/local/bin/$Repo" \
&& rm $Latest_tar