WSL2: Difference between revisions
mNo edit summary |
mNo edit summary |
||
Line 2: | Line 2: | ||
* https://docs.microsoft.com/en-us/windows/wsl/wsl-config | * https://docs.microsoft.com/en-us/windows/wsl/wsl-config | ||
= Networking = | |||
== Network bridge to Ethernet Adapter == | == Network bridge to Ethernet Adapter == | ||
Line 45: | Line 27: | ||
</pre> | </pre> | ||
= Docker in WSL = | |||
* install docker on linux | * install docker on linux | ||
* add to ~/.bashrc | * add to ~/.bashrc | ||
Line 56: | Line 38: | ||
fi | fi | ||
</pre> | </pre> | ||
= Other = | |||
== Using New Windows Terminal == | |||
* profiles.json | |||
** set defaultProfile to Ubuntu | |||
** for linux home dir: | |||
<blockquote> | |||
<pre> | |||
"commandline" : "wsl.exe ~ -d Ubuntu-20.04", | |||
</pre> | |||
</blockquote> | |||
== Running Linux Commands == | |||
* using bash.exe | |||
<pre> | |||
bash.exe -c "jupyter-notebook ; /bin/bash" | |||
</pre> | |||
* using wsl | |||
<pre> | |||
wsl jupyter-notebook & | |||
</pre> | |||
== Multiple Distro Instances == | == Multiple Distro Instances == |
Revision as of 23:40, 3 December 2021
Links
Networking
Network bridge to Ethernet Adapter
.wslconfig
- C:\Users\UserName\.wslconfig
[wsl2] memory=4GB # Limits VM memory in WSL 2 to 4 GB processors=2 # Makes the WSL 2 VM use two virtual processors
fstab
z: /mnt/z drvfs rw,relatime 0 0
mount -t drvfs '\\server\share' /mnt/share
Docker in WSL
- install docker on linux
- add to ~/.bashrc
# Start Docker daemon automatically when logging in if not running. RUNNING=`ps aux | grep dockerd | grep -v grep` if [ -z "$RUNNING" ]; then sudo dockerd > /dev/null 2>&1 & disown fi
Other
Using New Windows Terminal
- profiles.json
- set defaultProfile to Ubuntu
- for linux home dir:
"commandline" : "wsl.exe ~ -d Ubuntu-20.04",
Running Linux Commands
- using bash.exe
bash.exe -c "jupyter-notebook ; /bin/bash"
- using wsl
wsl jupyter-notebook &
Multiple Distro Instances
* Settings -> Apps -> Ubuntu -> Advanced -> Reset to initial state wsl --list wsl --export Ubuntu-20.04 Ubuntu_fresh_rootfs.tar.gz wsl --import DistroName InstallationPath Ubuntu_fresh_rootfs.tar.gz wsl -d DistroName
- alternative: https://github.com/yuk7/wsldl