Get-ChildItem
List files in a folder
Get-ChildItem -Path .\docs
- Works on
- WindowsLinuxmacOS
- PowerShell
- 5.1 and later
- Reference
- Microsoft Learn: Get-ChildItem
- PowerShell 7 On Linux and macOS, ls runs the system command instead of this cmdlet. Type the full cmdlet name there.
What you'll see
Directory: C:\Path\To\docs
Mode LastWriteTime Length Name
---- ------------- ------ ----
d---- 10/1/2026 9:12 AM images
-a--- 10/3/2026 4:40 PM 2048 notes.txt
-a--- 10/5/2026 11:02 AM 18233 report.docx
Lists files and folders. Point -Path at a folder. Skip -Path and it uses the current directory.
Common parameters
-Recursewalks subfolders.-Fileor-Directoryfilters the type.-Filter *.logis the fast way to match a pattern.
Try this
Get-ChildItem -Path .\docs -Recurse -File -Filter *.md
Coming from another shell
| Shell | What you might type |
|---|---|
| bash / zsh | ls -la |
| cmd.exe | dir |
ls -la does not work: -Force is what shows hidden files.
More in From bash and From cmd.