ubuntu进入桌面自动启动脚本_wsl ubuntu 如何设置开机自启脚本(shell script)

工欲善其事,必先利其器

设置WSL为版本2。

添加右键打开,注册表写入更改下面的名字哦

Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Directory\background\shell\Bash]

@="Bash here"

[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Directory\background\shell\Bash\command]

@="C:\\Users\\[your-name]\\AppData\\Local\\Microsoft\\WindowsApps\\Microsoft.WindowsTerminal_8wekyb3d8bbwe\\wt.exe"

[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Directory\shell\Bash]

@="Bash here"

[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Directory\shell\Bash\command]

@="C:\\Users\\[your-name]\\AppData\\Local\\Microsoft\\WindowsApps\\Microsoft.WindowsTerminal_8wekyb3d8bbwe\\wt.exe"

在添加~/.bashrc中添加

export windows_host=`ipconfig.exe | grep -n4 WSL | tail -n 1 | awk -F":" '{ print $2 }' | sed 's/^[ \r\n\t]*//;s/[ \r\n\t]*$//'`

export ALL_PROXY=socks5://$windows_host:1080

export HTTP_PROXY=$ALL_PROXY

export http_proxy=$ALL_PROXY

export HTTPS_PROXY=$ALL_PROXY

export https_proxy=$ALL_PROXY

sudo sed -i -E "s#socks5.*?1080#socks5://$windows_host:1080#" /etc/default/docker

if [ "`git config --global --get proxy.https`" != "socket5://$windows_host:1080" ]; then

git config --global proxy.https socks5://$windows_host:1080

fi

#重写cd

# cd C:\\ 自动切换到 /mnt/c

function cd() {

command cd `wslpath "$1"`

}

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值