Bash on Windows各類配置

原創文,最初發佈於 szhshp的第三邊境研究所 , 轉載請註明html

安裝

PowerShell裏面執行git

Enable-WindowsOptionalFeature -Online -FeatureName Microsoft-Windows-Subsystem-Linux

重啓電腦github

配置

apt-get換源

原文件重命名備份

sudo mv /etc/apt/sources.list /etc/apt/source.list.bak 

編輯源列表文件

sudo vim /etc/apt/sources.list 

使用下面的內容shell

(注意這個只是給Ubuntu16.04版本使用, 你安裝的時候應該默認就是這個版本)ubuntu

deb http://mirrors.aliyun.com/ubuntu/ xenial main restricted universe multiverse deb http://mirrors.aliyun.com/ubuntu/ xenial-security main restricted universe multiverse deb http://mirrors.aliyun.com/ubuntu/ xenial-updates main restricted universe multiverse deb http://mirrors.aliyun.com/ubuntu/ xenial-backports main restricted universe multiverse ##測試版源 deb http://mirrors.aliyun.com/ubuntu/ xenial-proposed main restricted universe multiverse # 源碼 deb-src http://mirrors.aliyun.com/ubuntu/ xenial main restricted universe multiverse deb-src http://mirrors.aliyun.com/ubuntu/ xenial-security main restricted universe multiverse deb-src http://mirrors.aliyun.com/ubuntu/ xenial-updates main restricted universe multiverse deb-src http://mirrors.aliyun.com/ubuntu/ xenial-backports main restricted universe multiverse ##測試版源 deb-src http://mirrors.aliyun.com/ubuntu/ xenial-proposed main restricted universe multiverse # Canonical 合做夥伴和附加 deb http://archive.canonical.com/ubuntu/ xenial partner deb http://extras.ubuntu.com/ubuntu/ xenial main 

而後bash方面更新:vim

sudo apt-get update
sudo apt-get upgrade

zsh

zsh的安裝都是老生常談了windows

簡單的安裝直接看這篇文章bash

固然oh-my-zsh也要一塊兒安裝測試

沒法將zsh做爲默認shell

這一部分和純ubuntu系統的設置不太同樣spa

安裝zsh以後, 首先查看一下你當前的shell

echo $SHELL 

應該會顯示

/bin/bash

畢竟用各類方法切換不成功, 根據相關Issue, 這個時候就應該編輯這個文件:

vi ~/.bashrc

在這個文件末尾加上

bash -c zsh

這樣就能夠自動進入zsh了

autojump_chpwd:4:nice(5) failed: operation not permitted

這是一個很奇怪的問題, 根據相關Issue, zsh但願調整進程的優先度,所以致使的錯誤

須要在.bashrc文件最後加上一句

unsetopt BG_NICE 

而後從新啓動bash便可解決問題

感受想配置起來也不是這麼容易呀

參考文獻

相關文章
相關標籤/搜索