Search code examples
powershellwindows-subsystem-for-linux

How do I filter from plain text output


I'm running wsl -l -v to get a list of WSL VMs on my computer and I get a list like this:

NAME             STATE     VERSION
Ubuntu-18-04     Stopped   2
Ubuntu-20-04     Running   2

I only want to see the ones that are running.
I tried:

wsl -l -v | Select-Object NAME

but I just get a list of blank lines.


Solution

  • just found this in --help docs

    wsl -l --running
    

    output:

    Windows Subsystem for Linux Distributions:
    Ubuntu (Default)