date:
updated:

wsl_ubuntu的某些操作


设定bash

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
$ cat <<'END' >> ~/.bashrc
PROMPT_COMMAND=__prompt_command
__prompt_command() {
local EXIT="$?"
PS1=""
local RCol='\[\e[0m\]'
local Red='\[\e[0;31m\]'
local Gre='\[\e[0;32m\]'
local Yel='\[\e[1;33m\]'
local Blu='\[\e[1;34m\]'
local Pur='\[\e[0;35m\]'
if [ $EXIT != 0 ]; then
PS1+="${Red}$EXIT${RCol}"
else
PS1+="${Gre}0${RCol}"
fi
PS1+="${Pur}|${RCol}${Blu}\W${RCol}${Pur}>${RCol} "
}
export EDITOR=vim
export CLICOLOR=1
export LSCOLORS=gxBxhxDxfxhxhxhxhxcxcx
END

初始化

sudo apt-get install build-essential curl file git

anaconda3环境变量

1
2
3
# add anaconda3
export PATH=/home/miku/anaconda3/bin:$PATH
export LD_LIBRARY_PATH=/home/miku/anaconda3/lib:$LD_LIBRARY_PATH

配置git

1
2
git config --global user.email "mgq499243711@gmail.com"
git config --global user.name "Hmiku-suki"

Xserver

在WSL中配置环境变量DISPLAY,在~/.bashrc中加入相关配置。
WSL1为:

1
export DISPLAY=localhost:0

WSL2为:

1
export DISPLAY=`cat /etc/resolv.conf | grep nameserver | awk '{print $2}'`:0`

← Prev nowcoder练习 | English word Next →