-
Notifications
You must be signed in to change notification settings - Fork 0
wsl commands
wsl --list
output: Ubuntu-22.04 (Default)
wsl.exe -l --all
wsl --export
cd c:\le\export-wsl
wsl --export "Ubuntu-22.04" ".\leubuntu.zar"
wsl --install
wsl --list output: Ubuntu-22.04 (Default) wsl --export
wsl --list --online
wsl --list --verbose
wsl --set-default-version
wsl --set-default
cd c:\le\export-wsl
wsl --export "Ubuntu-22.04" ".\Ubuntu-22.zar"
wsl --import <Directory location of the exported .tar file>
wsl --import Ubuntu-22.04 "C:\ubuntu-import" "C:\ubuntu-export\Ubuntu-22.zar"
###To run the specific WSL Linux distro imported from the exported .tar backup file
wsl -d
~
wsl --distribution --user
wsl --user
config --default-user
wsl --shutdown
wsl --import-in-place
Imports the specified .vhdx file as a new distribution. The virtual hard disk must be formatted in the ext4 filesystem type.
wsl --unregister
wsl --unregister Ubuntu-22.04
wsl --unregister Ubuntu
PowerShell
Copy wsl --mount Attach and mount a physical disk in all WSL2 distributions by replacing with the directory\file path where the disk is located. See Mount a Linux disk in WSL 2. Options include:
- --vhd: Specifies that refers to a virtual hard disk.
- --name: Mount the disk using a custom name for the mountpoint
- --bare: Attach the disk to WSL2, but don't mount it.
- --type : Filesystem type to use when mounting a disk, if not specified defaults to ext4. This command can also be entered as: wsl --mount -t .You can detect the filesystem type using the command: blkid , for example: blkid <dev/sdb1>.
- --partition : Index number of the partition to mount, if not specified defaults to the whole disk.
- --options : There are some filesystem-specific options that can be included when mounting a disk. For example, ext4 mount options like: wsl --mount -o "data-ordered" or wsl --mount -o "data=writeback. However, only filesystem-specific options are supported at this time. Generic options, such as ro, rw, or noatime, are not supported.
Go to registry Computer\HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Lxss change the DistributionName value
wsl --distribution ubuntu-22.04 -u ledang
cd /home/ledang
lsb_release -a
https://learn.microsoft.com/en-us/windows/wsl/basic-commands