Access a localhost running in Windows from inside WSL2? [closed]

Short answer for most recent Windows versions mDNS has been a feature of WSL2 for a while now. Concatenating your WSL2 hostname (or the equivalent command/function in your programming/language environment) with “.local” should get you access. For example, from Bash, try: ping “$(hostname).local” For instance, if your hostname is “MyComputer”, then the mDNS should be … Read more

Getting PyCharm to recognize python on the windows linux subsystem (bash on windows)

Using PyCharm Professional with WSL Python on Win10 Starting SSH PyCharm can only be configured to use WSL Python as a Remote Interpreter (this is due to lack of other public API). Install Win10 build 14361 or later. You also can upgrade your current Insider Preview. Install wsl (something like lxrun /install` && lxrun /update … Read more

How to use a new Windows Terminal app for SSH? [closed]

You can use a commandline field in your profile configuration to initiate an SSH connection on tab creation. Step-by-step guide: Ensure you have an SSH client (try to connect to the server from a Command Prompt tab). @dhgouveia2’s post details this step. Open Settings (Ctrl+,) Find the “list” array in the “profiles” object Find a … Read more

How to connect to windows postgres Database from WSL

WSL2 assigns IP address to the Windows host dynamically and the IP addresses can change without even rebooting Windows (see Notes below). So to reliably connect we’ll need to: Allow Windows and Postgres to accept connections from the WSL2 IP address range (not allowed by default) From WSL2, determine the Windows/Postgresql host’s IP address (which … Read more

How to check if a program is run in Bash on Ubuntu on Windows and not just plain Ubuntu?

The following works in bash on Windows 10, macOS, and Linux: #!/bin/bash set -e if grep -qEi “(Microsoft|WSL)” /proc/version &> /dev/null ; then echo “Windows 10 Bash” else echo “Anything else” fi You need to check for both “Microsoft” and “WSL” per this comment by Ben Hillis, WSL Developer: For the time being this is … Read more

What is the docker-desktop-data distro used for when running docker desktop with the WSL 2 engine

The docker-desktop-data distro is used by the docker-desktop distro as the backing store for container images etc. When docker is run under Hyper-V the same result is achieved by mounting a VHD in the Hyper-V image but this isn’t possible with WSL2. To quote from the docker blog introducing the new wsl2 backend: This will … Read more

Detect “Ubuntu on Windows” vs native Ubuntu from bash script [duplicate]

It looks like /proc/version in Ubuntu on Windows contains: Linux version 3.4.0-Microsoft (Microsoft@Microsoft.com) (gcc version 4.7 (GCC) ) #1 SMP PREEMPT Wed Dec 31 14:42:53 PST 2014 and my version of Ubuntu has: Linux version 4.4.0-31-generic (buildd@lgw01-16) (gcc version 5.3.1 20160413 (Ubuntu 5.3.1-14ubuntu2.1) ) #50-Ubuntu SMP Wed Jul 13 00:07:12 UTC 2016 This code is … Read more