Windows Subsystem For Linux (WSL): Unterschied zwischen den Versionen

Aus MattWiki
Keine Bearbeitungszusammenfassung
Keine Bearbeitungszusammenfassung
 
Zeile 11: Zeile 11:
  wsl -d <distro>                  # Run specific distribution
  wsl -d <distro>                  # Run specific distribution
  wsl -u <username>                # Run image with specific  
  wsl -u <username>                # Run image with specific  
wsl -v                          # Show WSL version
wsl --status                    # Show status of WSL
wsl --update                    # Update WSL Core components - Run cmd.exe as admin


=== Install ===
=== Install ===

Aktuelle Version vom 28. Juli 2025, 18:19 Uhr

This article focuses on managing and working with WSL or Windows Subsystem for Linux.

For developing with containers see Development Containers (CAP)

Managing WSL

Basic Commands

wsl --list or wsl -l             # Show list of locally available distributions
wsl -l -o                        # Show list of online available distributions
wsl -l -v                        # Show running status
wsl -d <distro>                  # Run specific distribution
wsl -u <username>                # Run image with specific 
wsl -v                           # Show WSL version
wsl --status                     # Show status of WSL
wsl --update                     # Update WSL Core components - Run cmd.exe as admin

Install

wsl -l -o                        # Lookup available distributions online
wsl -install <distro_name>       # install distribution
wsl --set-default <Distribution Name>       # Set default distribution name

Uninstall

wsl --unregister <distro>

Hint: This unregisters the distribution from WLS and also removes most of the files from the disk (see disk locations below)

Clone Image

wsl --export <distro> <filename.tar.gz>
wsl --import <new-distro-name> <distrolocation> <filename.tar.gz>

Disk Location of Distributions

Location of distros is

%LOCALAPPDATA%\packages\<subfolder-for-distro>

or

C:\Users\<username>\AppData\Local\packages\<subfolder-for-distro>

Sources

https://learn.microsoft.com/en-us/windows/wsl/basic-commands#list-available-linux-distributions

Logging in as Root

wsl.exe -u root                   # Run image as root

Installing Software

sudo apt-get install <softwarepackage>