Hack Forums
WSL 2 CHEAT SHEET WINDOWS 11 - Printable Version

+- Hack Forums (https://hackforums.net)
+-- Forum: Hacks, Exploits, and Various Discussions (https://hackforums.net/forumdisplay.php?fid=45)
+--- Forum: Grayhat โ€ข Purple Team โ€ข Hybrid Security (https://hackforums.net/forumdisplay.php?fid=449)
+---- Forum: Beginner Hacking (https://hackforums.net/forumdisplay.php?fid=4)
+---- Thread: WSL 2 CHEAT SHEET WINDOWS 11 (/showthread.php?tid=6329957)



WSL 2 CHEAT SHEET WINDOWS 11 - Clumsy - Aug 9, 2026

๐Ÿง 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! ๐Ÿ”ฅ


RE: WSL 2 CHEAT SHEET WINDOWS 11 - Terry A. Davis - Aug 9, 2026

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.


RE: WSL 2 CHEAT SHEET WINDOWS 11 - Clumsy - Aug 14, 2026

(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 :)