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 --shutdown restarts the WSL 2 virtual machine

CLI
~/tips/tip-windows-wsl-shutdown

wsl --shutdown

Stops every WSL distribution and the WSL 2 utility VM, so config changes take effect.

Edit .wslconfig, reopen your Linux terminal, and nothing has changed. That is normal: the WSL 2 virtual machine is still running with the old settings. One command resets it.

wsl --shutdown

The documentation says it immediately terminates all running distributions and the WSL 2 lightweight utility virtual machine. It names two typical reasons to use it: changing memory usage limits and making a change to your .wslconfig file.

After editing the file, run the command and then open your distribution again. It starts in a fresh VM, so the new settings apply.

The caveat is the word immediately. Nothing inside the distributions gets a chance to wrap up, so save your work and stop long-running jobs first, such as a database or a build. Anything you started in a Linux shell dies with it.

To stop a single distribution and leave the rest running, wsl --terminate <Distribution Name> does that. Use wsl --list --running to see what is up before you decide.

To check afterwards what you are running, wsl --version shows the version information of WSL and its components, and wsl --status shows general information such as the default distribution and the kernel version.

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

Link