Bash on Windows各種配置

來源:互聯網
上載者:User

標籤:class   導致   span   sop   targe   doc   ted   update   rest   

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

安裝

PowerShell裡面執行

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

重啟電腦

配置apt-get換源原檔案重新命名備份
sudo mv /etc/apt/sources.list /etc/apt/source.list.bak
編輯源列表檔案
sudo vim /etc/apt/sources.list

使用下面的內容

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

deb http://mirrors.aliyun.com/ubuntu/ xenial main restricted universe multiversedeb http://mirrors.aliyun.com/ubuntu/ xenial-security main restricted universe multiversedeb http://mirrors.aliyun.com/ubuntu/ xenial-updates main restricted universe multiversedeb 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 multiversedeb-src http://mirrors.aliyun.com/ubuntu/ xenial-security main restricted universe multiversedeb-src http://mirrors.aliyun.com/ubuntu/ xenial-updates main restricted universe multiversedeb-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 partnerdeb http://extras.ubuntu.com/ubuntu/ xenial main

然後bash方面更新:

sudo apt-get updatesudo apt-get upgrade
zsh

zsh的安裝都是老生常談了

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

當然oh-my-zsh也要一起安裝

無法將zsh作為預設shell

這一部分和純ubuntu系統的設定不太一樣

安裝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即可解決問題

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

參考文獻
  • https://docs.microsoft.com/en-us/windows/wsl/install-win10
  • https://www.cnblogs.com/gabin/p/6519352.html
  • https://www.cnblogs.com/seayxu/p/5568830.html
  • https://github.com/Microsoft/WSL/issues/1887

Bash on Windows各種配置

相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.