WSL lets developers run a GNU/Linux environment β including most command-line tools, utilities, and applications β directly on Windows, unmodified, without the overhead of a traditional virtual machine or dual-boot setup.
Installing Linux on Windows with WSL
https://learn.microsoft.com/en-us/windows/wsl/install
- Open PowerShell or Windows Command Prompt in administrator mode, enter the 
wsl --install command, then restart your machine. 
wsl --install- Display information about the version of Ubuntu installed
 
lsb_release -alsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 22.04.5 LTS
Release:        22.04
Codename:       jammy
- Access WSL files from Windows File Exlporer
 
\\wsl.localhost\Ubuntu\home\<your-username>\9/11/25
- List all installed WSL distros
 
wsl -l -v- Example output
 
  NAME                   STATE           VERSION
* Ubuntu                 Running         2
  docker-desktop-data    Stopped         2
  Ubuntu-22.04           Running         2
  docker-desktop         Stopped         2
- Open a specific distro
 
wsl -d <distro-name>- Set a default distro that runs when you type 
wsl 
wsl --set-default <distro-name>WSLg
WSLg (Windows Subsystem for Linux GUI) is integrated into WSL2 and provides native GUI support for Linux applications (X11 and Wayland)
- Verify that you are running Windows 11 with WSLg
 
echo $WSL_INTEROPEnable suport for Linux GUI apps
Networking and Firewall Configuration
https://learn.microsoft.com/en-us/windows/wsl/networking
Mirrored mode networking
https://learn.microsoft.com/en-us/windows/wsl/networking#mirrored-mode-networking
- Set networkingMode=mirrored under [wsl2] in the .wslconfig file to enable mirrored mode networking
 
Configure Windows Firewall for WSL
- 
Configure Hyper-V firewall to disable firewall
- Get WSL VM id
 
Get-NetFirewallHyperVVMCreatorVMCreatorId : {40E0AC32-46A5-438A-A0B2-2B479E8F2E90} FriendlyName : WSL- Disable firewall
 
Set-NetFirewallHyperVVMSetting -Name '{40E0AC32-46A5-438A-A0B2-2B479E8F2E90}' -Enabled False - 
List existing firewall rules
 
Get-NetFirewallRule -DisplayName *WSL*- Allow all traffic
 
New-NetFirewallRule -DisplayName "Allow All WSL Traffic" -Direction Inbound -Action Allow -Protocol AnyName                          : {5a95604b-9e6b-456b-b649-70d64afb4793}
DisplayName                   : Allow All WSL Traffic
Description                   :
DisplayGroup                  :
Group                         :
Enabled                       : True
Profile                       : Any
Platform                      : {}
Direction                     : Inbound
Action                        : Allow
EdgeTraversalPolicy           : Block
LooseSourceMapping            : False
LocalOnlyMapping              : False
Owner                         :
PrimaryStatus                 : OK
Status                        : The rule was parsed successfully from the store. (65536)
EnforcementStatus             : NotApplicable
PolicyStoreSource             : PersistentStore
PolicyStoreSourceType         : Local
RemoteDynamicKeywordAddresses : {}
PolicyAppId                   :
- To remove the rule
 
Remove-NetFirewallRule -DisplayName "Allow All WSL Traffic"- A safer alternative is to Only allow connection to wsl in a Trusted (Private) network
- Remove with 
Remove-NetFirewallHyperVRule -Name 'WSL Rule 
 - Remove with 
 
New-NetFirewallHyperVRule `
-DisplayName 'Allow All Inbound Traffic to WSL in Private Network' `
-Name 'WSL Rule' `
-Profiles Private `
-Direction Inbound `
-Action Allow `
-VMCreatorId '{40E0AC32-46A5-438A-A0B2-2B479E8F2E90}' `
-Enabled TrueConnecting USB devices to wsl2
[1/14/25]
Using USBIPD-WIN on WSL
https://learn.microsoft.com/en-us/windows/wsl/connect-usb
- Install USBIPD
 
winget install --interactive --exact dorssel.usbipd-win- Open PowerShell in administrator mode and list USB devices connected to Windows
 
usbipd listConnected:
BUSID  VID:PID    DEVICE                                                        STATE
1-9    13d3:56eb  USB2.0 HD UVC WebCam, USB2.0 IR UVC WebCam, Camera DFU De...  Not shared
1-14   8087:0026  Intel(R) Wireless Bluetooth(R)                                Not shared
3-1    093a:2533  USB Input Device                                              Not shared
3-2    20d6:2035  Xbox Gaming Device                                            Shared
3-3    1532:0016  USB Input Device                                              Not shared
3-4    1532:010d  USB Input Device                                              Not shared
Persisted:
GUID                                  DEVICE
- Share the USB device using the bus ID
 
usbipd bind --busid 3-2 - Attach the USB device to WSL (a WSL command prompt must also be open open )
- Note that as long as the USB device is attached to WSL, it cannot be used by Windows
 
 
usbipd attach --wsl --busid 3-2- Open Ubuntu/WSL and list the attached USB devices
 
usbipd: info: Using WSL distribution 'Ubuntu' to attach; the device will be available in all WSL 2 distributions.
usbipd: info: Using IP address 127.0.0.1 to reach the host.
- Verify that the device is attached using 
usbipd list 
Connected:
BUSID  VID:PID    DEVICE                                                        STATE
1-9    13d3:56eb  USB2.0 HD UVC WebCam, USB2.0 IR UVC WebCam, Camera DFU De...  Not shared
1-14   8087:0026  Intel(R) Wireless Bluetooth(R)                                Not shared
4-1    093a:2533  USB Input Device                                              Not shared
4-2    20d6:2035  Xbox Gaming Device                                            Attached
4-3    046d:c08b  G502 HERO, USB Input Device, Virtual HID Framework (VHF) ...  Not shared
4-4    1532:010d  USB Input Device                                              Not shared
- From the WSL prompt, verify that the device is listed
 
lsusbBus 002 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 001 Device 002: ID 20d6:2035 PowerA Xbox Series X Wired Controller Black
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
- Disconnect the device once you are done
 
usbipd detach --busid <busid>- Note: You will still likely need to recompile the Linux kernel to make the drivers available in WSL (See below)
 
Compile your own Linux kernel
Enable gamepad support in WSL
- Check device permissions and user group
 
ls -l /dev/bus/usb/001/002crw-rw-r-- 1 root root 189, 1 Jan 15 04:14 /dev/bus/usb/001/002
- Check for joystick device
 
ls /dev/inputby-id  by-path  event0  js0
- run 
jstest 
jstest /dev/input/js0Driver version is 2.1.0.
Joystick (Generic X-Box pad) has 8 axes (X, Y, Z, Rx, Ry, Rz, Hat0X, Hat0Y)
and 11 buttons (BtnA, BtnB, BtnX, BtnY, BtnTL, BtnTR, BtnSelect, BtnStart, BtnMode, BtnThumbL, BtnThumbR).
Testing ... (interrupt to exit)
Axes:  0:     0  1:     0  2:     0  3:     0  4:     0  5:     0  6:     0  7:     0 Buttons:  0:off  1:off  2:off  3:oAxes:  0:     0  1:     0  2:     0  3:     0  4:     0  5:     0  6:     0  7:     0 Buttons:  0:off  1:off  2:off  3:oAxes:  0:     0  1:     0  2:     0  3:     0  4:     0  5:     0  6:     0  7:     0 Buttons:  0:off  1:off  2:off  3:oAxes:  0:     0  1:     0  2:     0  3:     0  4:     0  5:     0  6:     0  7:     0 Buttons:  0:off  1:off  2:off  3:oAxes:  0:     0  1:     0  2:     0  3:     0  4:     0  5:     0  6:     0  7:     0 Buttons:  0:off  1:off  2:off  3:oAxes:  0:     0  1:     0  2:     0  3:     0  4:     0  5:     0  6:     0  7:     0 Buttons:  0:off  1:off  2:off  3:oAxes:  0:     0  1:     0  2:     0  3:     0  4:     0  5:     0  6:     0  7:     0 Buttons:  0:off  1:off  2:off  3:oAxes:  0:     0  1:     0  2:     0  3:     0  4:     0  5:     0  6:     0  7:     0 Buttons:  0:off  1:off  2:off  3:oAxes:  0:     0  1:     0  2:     0  3:     0  4:     0  5:     0  6:     0  7:     0 Buttons:  0:off  1:off  2:off  3:oAxes:  0:     0  1:     0  2:     0  3:     0  4:     0  5:     0  6:     0  7:     0 Buttons:  0:off  1:off  2:off  3:oAxes:  0:     0  1:     0  2:     0  3:     0  4:     0  5:     0  6:     0  7:     0 Buttons:  0:off  1:off  2:off  3:oAxes:  0:     0  1:     0  2:     0  3:     0  4:     0  5:     0  6:     0  7:     0 Buttons:  0:off  1:off  2:off  3:oAxes:  0:     0  1:    90  2:     0  3:     0  4:     0  5:     0  6:     0  7:     0 Buttons:  0:off  1:off  2:off  3:oAxes:  0:     0  1:    90  2:-32767  3:     0  4:     0  5:     0  6:     0  7:     0 Buttons:  0:off  1:off  2:off  3:oAxes:  0:     0  1:    90  2:-32767  3:   278  4:     0  5:     0  6:     0  7:     0 Buttons:  0:off  1:off  2:off  3:oAxes:  0:     0  1:    90  2:-32767  3:   278  4:   161  5:     0  6:     0  7:     0 Buttons:  0:off  1:off  2:off  3:oAxes:  0:     0  1:    90  2:-32767  3:   278  4:   161  5:-32767  6:     0  7:     0 Buttons:  0:off  1:off  2:off  3:oAxes:  0:     0  1:    90  2:-32767  3:   278  4:   161  5:-32767  6:     0  7:     0 Buttons:  0:off  1:off  2:off  3:oAxes:  0:     0  1:    90  2:-32767  3:   278  4:   161  5:-32767  6:     0  7:     0 Buttons:  0:off  1:off  2:off  3:off  4:off  5:off  6:off  7:off  8:off  9:off 10:off





WSLg (Windows Subsystem for Linux GUI) is integrated into WSL2 and provides native GUI support for Linux applications (X11 and Wayland)