WSL Basics
Install WSL
wsl -l -o# Open Powershell & get a list of available Linux distributions available for downloadwsl --install -d Ubuntu-22.04- If
Error: 0x800706d9 There are no more endpoints available from the endpoint mapper, Services -> Host Network Service -> Start, and rerun the commandwsl --install -d Ubuntu-22.04
Uninstall && Remove WSL
- Settings -> Apps -> Installed apps -> Ubuntu -> Uninstall
wsl -l -v# Open Powershell & Get WSL versionwsl --unregister Ubuntu
Keeping WSL Running in the Background (even after closing the terminal window)
wsl --exec dbus-launch truein powershell
Accessing a WSL service from a remote machine (Mirror a WSL ip address and port to that of the host)
wsl hostname -I# Get WSL local IP address (CMD or Powershell)netsh interface portproxy add v4tov4 listenport=11434 listenaddress=0.0.0.0 connectport=11434 connectaddress=172.19.98.153# Run in CMD as administrator- Open the port in
Inbound RulesinWindows Defender Firewall with Advanced Security on Local Computer
How to Shrink a WSL2 Virtual Disk
wsl --shutdown# Open Powershell and shutdown the running WSL distributionsdiskpart
DISKPART> select vdisk file="C:\Users\penl\AppData\Local\Packages\CanonicalGroupLimited.Ubuntu22.04LTS_79rhkp1fndgsc\LocalState\ext4.vhdx"
DiskPart successfully selected the virtual disk file.
DISKPART> compact vdisk
100 percent completed
DiskPart successfully compacted the virtual disk file.