brewedbits.dev

Personal blog with guides and news on selfhosting, Linux and AI, from the Netherlands

nextDash nextdash --aboutYour bookmarks. Your terminal. checks your links knows your Docker host one container, no cloudLive demo →nextdash.cc ↗

Tip: wsl --terminate stops one distribution and leaves the others running

CLI
~/tips/tip-windows-wsl-terminate-distribution

wsl --terminate <Distribution Name>

Stops a single named WSL distribution without shutting down the whole WSL 2 VM.

A runaway process in one Linux distribution does not mean you have to kill every other one. WSL can stop them one by one.

wsl --terminate <Distribution Name>

Per the documentation, you replace the placeholder with the name of the distribution you want to stop. For example:

wsl --terminate Ubuntu

First, check what is running. The list command takes a few options, among them --running to show only distributions that are currently running, and --verbose for the state and the WSL version of each:

wsl --list --running
wsl --list --verbose

The difference with wsl --shutdown is scope. Shutdown terminates all running distributions and the WSL 2 lightweight utility virtual machine, while terminate stops only the named distribution. Use shutdown when a change to .wslconfig needs a fresh VM.

The caveat is that whatever runs inside that distribution stops with it, including background jobs and services you started. Unsaved work in a shell or an editor inside it is lost. The distribution’s files stay as they are, and it starts again the next time you open it.

None of this was run on a live Windows machine here. It follows the Microsoft documentation.

Further reading: Basic commands for WSL

More CLI tips wsl --shutdown wsl --distribution <Distribution Name> --user <User Name> Compress-Archive -Path C:\Reference -DestinationPath C:\Archives\Draft.zip rg -o -r '$2' '"(GET|POST) (\S+)' access.log redis-cli --json HGETALL user All CLI tips (60) All topics

Link