WSL 安装使用及美化
shell是一个抽象概念,shell的一切操作都在计算机内部,负责处理人机交互,执行脚本等,是操作系统能正常运行的重要组成部分
bash,ash,zsh,tcsh等是shell这个抽象概念的一种具体的实现,都是一个程序,都能生成一个进程对象。
如果想换shell的程序,可以修改/etc/passwd,把里面的/bin/bash换成你想要的shell,或者用chsh命令来切换
shell与终端的关系:shell把一些信息适当的输送到终端设备,同时还接收来自终端设备的输入。一般每个shell进程都会有一个终端关联,也可以没有。
1. 下载
在Windows Store下载
2.更换华为源
进入华为镜像源官网:https://mirrors.huaweicloud.com/
1、备份配置文件:
cp -a /etc/apt/sources.list /etc/apt/sources.list.bak
2、修改sources.list文件,将http://archive.ubuntu.com和http://security.ubuntu.com替换成http://repo.huaweicloud.com,可以参考如下命令:
sed -i "s@http://.*archive.ubuntu.com@http://repo.huaweicloud.com@g" /etc/apt/sources.list
sed -i "s@http://.*security.ubuntu.com@http://repo.huaweicloud.com@g" /etc/apt/sources.list
3、执行apt-get update更新索引
3. 更新和升级
sudo apt-get update
sudo apt-get upgrade
4. 安装 oh-my-zsh
a. 安装 zsh
sudo apt-get install zsh
设置默认 shell 为 zsh
chsh -s $(which zsh)
设置完成后使用下列命令检查是否设置成功
echo $SHELL
b. 安装 oh-my-zsh
sh -c "$(curl -fsSL https://raw.github.com/robbyrussell/oh-my-zsh/master/tools/install.sh)"
或
sh -c "$(wget https://raw.github.com/robbyrussell/oh-my-zsh/master/tools/install.sh -O -)"
安装完成后重新打开终端,终端就变成了 zsh 了。
c. 设置 ys 主题
打开 oh-my-zsh 配置文件
sudo vim ~/.zshrc
修改主题配色为 ys
ZSH_THEME="ys"
或者想每个主题都体验一下的话就将主题设置为 "random" 就好了(滑稽)。
保存退出后,重新加载下配置文件
source ~/.zshrc
5. 安装语法高亮插件
git clone https://github.com/zsh-users/zsh-syntax-highlighting.git
echo "source ${(q-)PWD}/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh" >> ${ZDOTDIR:-$HOME}/.zshrc
详细设置可以参考GitHub官方文档](https://github.com/zsh-users/zsh-syntax-highlighting)
使之生效
source ~/.zshrc
6. 简单配置 vim
打开 vim 配置文件
vim ~/.vimrc
添加以下内容
colorscheme ron
:syntax on
filetype on
filetype plugin on
filetype indent on
set sts=4
set shiftwidth=4
set backspace=2
set tabstop=4
set showmode
set nu
set nohlsearch
参考
少数派
scoop: