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 :
1# Update your WSL first
2wsl --update
3
4# Install the distrib you want
5wsl --install -d Ubuntu
6
7# Distrib you have to your disposition
8wsl --list --online
9
10# List all WSL installed
11wsl --list
12wsl --list -v
13
14# if needed to reinstall
15wsl --shutdown
16wsl --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:
1du -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:
1wsl --shutdown
2
3#Find ext4.vhdx in \Users\USER\AppData\Local\Packages\
4optimize-vhd -Path C:\Users\<USER>\AppData\Local\Packages\AlmaLinuxOSFoundation.AlmaLinux8WSL_xxxxxxxxxxxxxx\LocalState\ext4.vhdx -Mode full
Export/Import your WSL
1wsl --export AlmaLinux-8 AlmaLinux-8-full.tar.gz
2wsl --import AlmaLinux8-full C:\Users\<USER>\AppData\Local\Packages\Alma8-full .\AlmaLinux-8-full.tar
3wsl -d AlmaLinux8-full -u <USER> -s
4wsl --unregister AlmaLinux8-full
5
6wsl --list -v
Comments