Windows Subsystem for Linux (WSL)

In the 14.04 version of Ubuntu, ping is disabled until you launch the bash.exe in administrator mode !

If you want to have it without that, you need to enable insider release and reinstall the WSL and the new version of Ubuntu (16.04) will be installed and it will be available to non administrator mode.

Using cmder and zsh

/icon "%USERPROFILE%\AppData\Local\lxss\bash.ico"
"%windir%\System32\bash.exe" -cur_console:p ~

Run SSH server

Try another port than 22

https://www.reddit.com/r/bashonubuntuonwindows/comments/4w1t33/ssh_server_and_bash/?st=jaa2lsoj&sh=f9e9cd31

Add usb phone

https://learn.microsoft.com/en-us/windows/wsl/connect-usb

https://github.com/dorssel/usbipd-win/wiki/WSL-support#usbip-client-tools

First install https://github.com/dorssel/usbipd-win/releases

On WSL :

sudo apt install usbip usbutils jmtpfs

On powershell with admin rights

usbipd wsl list
usbipd wsl attach --busid <busid>

On WSL :

sudo mkdir /media/android
sudo jmtpfs -o allow_other /media/android/

WSL2 from VHDX

With 1.0.0 or later in place, to reuse a ext4.vhdx on a new computer:

Place your ext4.vhdx in the directory you want to use for the distribution. For instance, C:\Users\\WSL\ubuntu_22.04. The name of the directory doesn’t matter here.

From PowerShell:

wsl –import-in-place

For example

wsl –import-in-place ubuntu_22.04 C:\Users\ntd\WSL\ubuntu_22.04

Important: To avoid “confusing” the distribution installers, I recommend avoiding the distribution names that they would use. Examples of this include:
Ubuntu
Ubuntu-20.04
Debian
Alpine

This is why I use ubuntu_22.04 as an example, with the underscore in place of the hyphen.

Follow the instructions here for setting the default username in this new distribution/instance.

Optionally, use wsl –set-default to set the imported distribution as the default that will run when you just execute wsl. If this is the only distribution, it should automatically be set as default.

Source

Set default user

/etc/wsl.conf

The current Microsoft recommended way of setting the username in an instance is to create a /etc/wsl.conf in the instance with the following setting:

[user]
default=username

Source

Reduce disk size

In your WSL

sudo fstrim -av 

On powershell:

wsl --shutdown
diskpart
# this open Diskpart in new window
select vdisk file="C:\WSL\ext4.vhdx"
attach vdisk readonly
compact vdisk
detach vdisk
exit

Source