Command referenceGet-ChildItem
Get-ChildItem command (Windows / PowerShell)
What it does
Enumerate items and child items in filesystem, registry, and other providers. Guides covering the get-childitem powershell usually need pipeline-friendly examples, common parameters, and how the cmdlet compares with classic CMD or Linux tools. This page includes syntax, options, and copyable PowerShell examples.
Enumerate items and child items in filesystem, registry, and other providers.
Syntax
Get-ChildItem [[-Path] <String[]>] [-Filter <String>] [-Recurse] [-File] [-Directory] [-Force]
Common options
| Flag / option | Meaning |
|---|---|
| -Path | Select one or more provider paths. |
| -Recurse | Enumerate descendants. |
| -File | Return files only in the filesystem provider. |
| -Directory | Return directories only. |
| -Force | Include hidden and protected items. |
Practical examples
List hidden items
Get-ChildItem -Force
Includes normally hidden entries.
Find logs
Get-ChildItem C:\Logs -Filter *.log -Recurse -File
Recursively returns log files.
Largest files
Get-ChildItem . -File | Sort-Object Length -Descending | Select-Object -First 10
Selects the ten largest files.
Linux ↔ Windows equivalent
Closest match: ls (Linux / bash / sh / zsh). List directory entries and inspect file metadata.
Common mistakes
- Using `-Include` without a wildcard path or recursion and receiving unexpected results.
- Forgetting `-Force` when hidden items matter.
Related commands
- Set-LocationChange the current location to a path in a PowerShell provider.
- Get-ContentRead file content or provider data as a stream of objects.
- lsList directory entries and inspect file metadata.
- cdChange the shell's current working directory.
- dirList files and subdirectories with names, dates, sizes, and attributes.
- findWalk directory trees and select entries using tests and actions.
- cdDisplay or change the current directory in Command Prompt.
- rmRemove files and directory trees permanently.
FAQ
What does Get-ChildItem do in PowerShell?
Enumerate items and child items in filesystem, registry, and other providers.
How can I see examples for Get-ChildItem?
Run `Get-Help Get-ChildItem -Examples`, then adapt an example to the provider and objects you are using.
What is a practical Get-ChildItem example?
Try `Get-ChildItem -Force` — Includes normally hidden entries.
Does Get-ChildItem return text or objects?
Get-ChildItem normally participates in PowerShell's object pipeline; formatting seen in the console is a view of those objects.
Browse the full Linux and Windows command reference to search more bash, CMD, PowerShell, Conda, and GitHub CLI commands.