Skip to content

WSL distribution termination

WSL distribution termination refers to the process of manually stopping a specific WSL (Windows Subsystem for Linux) distribution that is currently running. This is often necessary to perform system maintenance, apply configuration changes, or cleanly unregister a distribution before deletion.

Command syntax

The termination operation is performed using the wsl command-line utility with the --terminate flag^[600-developer-tools-windows-wsl-command.md].

To stop a specific distribution, use the following syntax:

wsl --terminate <DistributionName>

For example, to terminate a distribution named U20.04-tommy:

wsl --terminate U20.04-tommy

Usage context

Termination is frequently used in conjunction with other WSL management tasks, such as:

  • Unregistering: Distributions are typically terminated before being unregistered to ensure the filesystem is not in use^[600-developer-tools-windows-wsl-command.md].
  • Configuration modification: Changes to system files (like /etc/wsl.conf) may require a restart, which is initiated by a termination followed by a relaunch^[600-developer-tools-windows-wsl-command.md].

The --terminate command is part of the standard lifecycle management for WSL distributions, alongside other utilities:

  • --import: Imports a specific distribution from a tar file^[600-developer-tools-windows-wsl-command.md].
  • --export: Exports a distribution to a tar file^[600-developer-tools-windows-wsl-command.md].
  • --unregister: Unregisters and deletes the distribution from the WSL list^[600-developer-tools-windows-wsl-command.md].
  • --list (-l): Lists all installed distributions, optionally with their states^[600-developer-tools-windows-wsl-command.md].

Sources

  • 600-developer-tools-windows-wsl-command.md