Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save benduran/3a0bd30e214d0d32e39aef4a6e9c8c1f to your computer and use it in GitHub Desktop.
Save benduran/3a0bd30e214d0d32e39aef4a6e9c8c1f to your computer and use it in GitHub Desktop.
Expose X 11 Display IP from WSL to the Windows Host

Add this to your .bashrc, .zshrc (or equivalent)

# Get the IP address of the host from /etc/resolv.conf
export WSL_HOST=$(tail -1 /etc/resolv.conf | cut -d' ' -f2)

# Set the display path
export DISPLAY=$WSL_HOST:0.0

Now you can use something like MobaXterm for X 11 forwarding and use Linux GUI applications natively in Windows!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment