WSL stand for Windows Subsystem Linux. It allow us to get the best of both Linux and Windows world…
Get Started
Of course, As admin inside a powershell terminal :
# Update your WSL first
wsl --update
# Install the distrib you want
wsl --install -d Ubuntu
# Distrib you have to your disposition
wsl --list --online
# List all WSL installed
wsl --list
wsl --list -v
# if needed to reinstall
wsl --shutdown
wsl --unregister Ubuntu
Windows Terminal
WSL is your Linux VM on windows, you can also use Windows Terminal for your own confort.
Here some shortcut in Windows Terminal but not only 😉 :
alt + enter
: mode full ecranctrl shift t
: terminalctrl shift n
: new windowsctrl alt 1 2 3
: changer de fenetreWindows + v
: see the paste bufferAlt Shift =
: split verticalAlt shit -
: split horizontalAlt arrow
: to change panelAlt shit arrow
: resize panelcode .
: open VSCode from your current directory
Free some space on your WSL
- checks which directory contains the most data:
du -h --max-depth 1
Activate Hyper-V module in windows features:
Inside the control-panel -> Turn windows features on or off -> activate Hyper-v -> restart.
This is required to activate optimize-vhd command.Let’s shrink - As admin in powershell:
wsl --shutdown
#Find ext4.vhdx in \Users\USER\AppData\Local\Packages\
optimize-vhd -Path C:\Users\<USER>\AppData\Local\Packages\AlmaLinuxOSFoundation.AlmaLinux8WSL_xxxxxxxxxxxxxx\LocalState\ext4.vhdx -Mode full
Export/Import your WSL
wsl --export AlmaLinux-8 AlmaLinux-8-full.tar.gz
wsl --import AlmaLinux8-full C:\Users\<USER>\AppData\Local\Packages\Alma8-full .\AlmaLinux-8-full.tar
wsl -d AlmaLinux8-full -u <USER> -s
wsl --unregister AlmaLinux8-full
wsl --list -v
Comments