IT-info

Windows Subsystem for Linux Documentation

WSL in Command Prompt / PowerShell

Commands

wsl --help

Opens a WSL usage guide with a list of available arguments and options.

wsl --list

List the WSL distros installed on your system.

wsl -u root

Starts default WSL distro and logs in at root.
To shutdown / exit the WSL distro, type exit and press the Enter key on your keyboard.

Setting up Ubuntu app in Windows 11 WSL- Quick guide

Ubuntu in WSL

Commands

Check version of distro you're in.

cat /etc/issue.net

When logged in into the WSL Ubuntu distro as root, use the command below to set/change a user password.

passwd username

Get network connection working

If you get no network connection in your WSL distro, try this;

Set proper DNS address in /etc/resolv.conf (The same address as the one in the output from ipconfig /all command on Windows host running the WSL)

You should try resetting the TCP/IP stack and clearing any DNS information on Windows host running the WSL (Windows 10).

To reset the network stack with Command Prompt, use these steps:

1. Open Start.

2. Search for Command Prompt, right-click the top result, and select the Run as administrator option.

3. Type the following command to reset the component that handles network requests and press Enter:

netsh winsock reset

4. Type the following command to reset the internet protocol stack and press Enter:

netsh int ip reset

5. Type the following command to clear the current networking configuration and press Enter:

ipconfig /release

6. Type the following command to reconfigure the network settings and press Enter:

ipconfig /renew

7. Type the following command to clear the DNS information cached and press Enter:

ipconfig /flushdns

8. Restart your computer.

Once you complete the steps, launch the web browser and confirm the internet is working.

Source: Cannot Connect to Internet From WSL2