Home Upgrade Search Memberlist Extras Hacker Tools Award Goals Help Wiki Contact

WSL 2 CHEAT SHEET WINDOWS 11

🐧 WSL 2 CHEAT SHEET — WINDOWS 11



📦 INSTALLATION & SETUP
Code
wsl --install                           # Install WSL with default Ubuntu
wsl --install -d Debian                 # Install specific distro
wsl --install -d kali-linux             # Install Kali Linux
wsl --list --online                     # Show available distros
wsl --set-default-version 2             # Set WSL 2 as default
wsl --set-version <distro> 2            # Convert distro to WSL 2

📋 LIST & MANAGE DISTROS
Code
wsl -l -v                               # List installed distros with version
wsl -l -o                               # List available distros from store
wsl -l --running                        # Show only running distros
wsl --set-default <distro>              # Set default distro
wsl --status                            # Show WSL status

🚀 START / STOP / EXECUTE
Code
wsl                                     # Start default distro
wsl -d Debian                           # Start specific distro
wsl -d Debian -u root                   # Start as root
wsl --shutdown                          # Shut down ALL WSL instances
wsl -t Debian                           # Terminate specific distro
wsl --export Debian C:\backup.tar       # Export distro to tar file
wsl --import NewDistro C:\WSL\New C:\backup.tar  # Import distro from tar

📂 WINDOWS → WSL FILE ACCESS
Code
explorer.exe .                          # Open current WSL dir in Windows Explorer
cd /mnt/c/Users/<user>/Desktop          # Access Windows Desktop
cd /mnt/c/                              # Access C: drive
cd /mnt/d/                              # Access D: drive
ls -la /mnt/                            # List all mounted Windows drives
wsl --mount <disk>                      # Mount external drive
wsl --unmount <disk>                    # Unmount drive

🔧 WSL CONFIGURATION
File: %UserProfile%\.wslconfig
Code
[wsl2]
memory=8GB
processors=4
localhostForwarding=true
nestedVirtualization=true
kernelCommandLine=vsyscall=emulate
swap=4GB
swapFile=C:\\temp\\wsl-swap.vhdx
Apply changes:
Code
wsl --shutdown
then restart

🖥️ WSL VS WINDOWS INTEGRATION
Code
wsl --exec <command>                    # Run command without shell
wsl ls -la                              # Run command directly
powershell.exe -c "Get-Date"            # Run PowerShell from WSL
cmd.exe /c dir                          # Run CMD from WSL
notepad.exe file.txt                    # Open file in Windows Notepad
code .                                  # Open VS Code in current dir

🔐 NETWORK & PORTS
Code
ip addr show                            # Show WSL IP address
cat /etc/resolv.conf                    # Show DNS config
wsl --exec bash -c "ip route get 1"     # Get WSL's Windows host IP
ssh user@localhost -p 2222              # SSH into WSL from Windows
socat TCP-LISTEN:80,fork TCP:localhost:8080  # Port forwarding

🗑️ UNINSTALL / REMOVE
Code
wsl --unregister Debian                 # Remove distro (deletes all data)
dism.exe /online /disable-feature /featurename:Microsoft-Windows-Subsystem-Linux  # Completely remove WSL
dism.exe /online /enable-feature /featurename:Microsoft-Windows-Subsystem-Linux /all /norestart  # Re-enable WSL

🐳 DOCKER IN WSL
Code
docker ps -a                            # List containers
docker images                           # List images
docker run -it --rm ubuntu bash         # Run test container
docker system prune -a                  # Clean up
sudo service docker start               # Start Docker daemon

🧹 QUICK CLEANUP
Code
wsl --shutdown
wsl --export Debian C:\backup\Debian_$(date +%Y%m%d).tar
wsl --unregister Debian

⚡ COMMON WORKFLOWS
Code
# Open WSL in VS Code
code .

# Transfer files between WSL and Windows
cp file.txt /mnt/c/Users/WindowsUser/Desktop/

# Access WSL files from Windows Explorer
\\wsl$\Debian

# SSH into WSL from Windows
ssh -p 22 [email protected]

# Open GUI app from WSL (if X server running)
DISPLAY=:0 firefox &

🔧 TROUBLESHOOTING
Code
# DNS not working
sudo bash -c 'echo "nameserver 8.8.8.8" > /etc/resolv.conf'

# WSL not starting
net stop LxssManager && net start LxssManager

# WSL is slow
# Check antivirus exclusions, ensure WSL 2

# Cannot access internet
sudo dhclient

# Systemd not working
# Need WSL 2 + systemd=true in /etc/wsl.conf

📌 WSL.CONF (per distro)
File: /etc/wsl.conf
Code
[user]
default=root

[interop]
enabled=true
appendWindowsPath=true

[network]
generateResolvConf=false

[boot]
systemd=true

[automount]
enabled=true
options=metadata,umask=22,fmask=11


💡 PRO TIP: Add
Code
alias wsl="wsl -d Debian"
to your PowerShell profile for quick access.


━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
☠️ USE RESPONSIBLY — NIGHTFALL-X OMEGA
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

🔥 PROPER MYBB HACKFORUMS STYLE NOW! 🔥
Hackerone.com/DBMS
Bugcrowd.com/Sleep
[email protected]
Youtube.com/Stripped
Github.com/SleepTheGod
Contact : linkedin.com/in/clumsy/
Contact : T.me/SleepTheGod
Fact: You can launch any Windows EXE from WSL if it's in your Windows PATH, you just need to be explicit with the .exe extension.

I think you can also do X server stuff on Windows through WSL (Though been a hot minute since I've done this) just need Xorg and a DM installed.
[Image: 3.gif]
(Aug 9, 2026 11:52 PM)Terry A. Davis Wrote:  Fact: You can launch any Windows EXE from WSL if it's in your Windows PATH, you just need to be explicit with the .exe extension.

I think you can also do X server stuff on Windows through WSL (Though been a hot minute since I've done this) just need Xorg and a DM installed.

This is very true thank you for pointing that out :)
Hackerone.com/DBMS
Bugcrowd.com/Sleep
[email protected]
Youtube.com/Stripped
Github.com/SleepTheGod
Contact : linkedin.com/in/clumsy/
Contact : T.me/SleepTheGod


Possibly Related Threads...
Thread / Author Replies Views Last Post
by ClumsySep 11, 2026 10:21 PM 1 49 Sep 11, 2026 10:21 PM
Last Post: CyberXero
by ClumsyJul 11, 2026 01:20 PM 4 203 Jul 11, 2026 01:20 PM
Last Post: HforumUser
by ClumsyDec 12, 2025 10:28 PM 0 106 Dec 12, 2025 10:28 PM
Last Post: Clumsy