windows_wsl
WSL
設定
ターミナルにGitのブランチ名を表示する
~/.bashrc
の末尾に下記を記入する
export PS1='\[\033[01;32m\]\u@\h\[\033[01;33m\] \w \[\033[01;31m\]$(__git_ps1 "(%s)") \n\[\033[01;34m\]\$\[\033[00m\] '
Tips
VSCodeの開き方
$ code .
エクスプローラの開き方
$ explorer.exe .
Pythonの実行
Linux側での実行
$ python3 Python 3.6.9 (default, Jan 26 2021, 15:33:00) [GCC 8.4.0] on linux Type "help", "copyright", "credits" or "license" for more information. >>>
Windows側での実行
$ python.exe Python 3.9.5 (tags/v3.9.5:0a7dcbd, May 3 2021, 17:27:52) [MSC v.1928 64 bit (AMD64)] on win32 Type "help", "copyright", "credits" or "license" for more information. >>>
再起動
reboot
やshutdown
は効かない- terminateオプションで指定したディストリビューションを終了できる
$ wsl -t Ubuntu-18.04
- shutdownオプションで全ディストリビューションを終了できる
$ wsl --shutdown
- なお、listオプションでディストリビューションの一覧を見ることもできる
$ wsl -l
参考
- Windows 10 に WSL をインストールする
- Microsoft Docs
- 2021/05/11
- Ubuntu(Linux)のプロンプトにGitのブランチ名を表示する方法
- Snow System
- 2021/05/13
- WSLのPATHからWindows側のPATHを除外する
- Qiita
- 2021/05/12
- (PCではなく)WSL2のみを終了、再起動する方法
- AsTechLog
- 2021/05/12
windows_wsl.txt · 最終更新: 2021/06/15 22:55 by 127.0.0.1