Commands / Text and objects

Where-Object

Filter objects in the pipeline

beginner Text and objects Aliases where?

Where-Object
 Get-ChildItem | Where-Object { $_.Extension -eq '.md' }
Works on
WindowsLinuxmacOS
PowerShell
5.1 and later
Reference
Microsoft Learn: Where-Object

What you'll see

    Directory: C:\Path\To\project

Mode                 LastWriteTime         Length Name
----                 -------------         ------ ----
-a---          10/2/2026  3:15 PM           4120 CONTRIBUTING.md
-a---          10/6/2026  8:47 AM           2875 README.md

Filters the pipeline. $_ is the current object. Comparison operators: -eq, -ne, -like, -gt, -lt.

There is a simpler syntax: Where-Object Extension -eq '.md'.

Try this

Get-Service | Where-Object Status -eq 'Running'

Coming from another shell

ShellWhat you might type
bash / zshls | grep '\.md$'

More in From bash and From cmd.

Related commands