ls — List directory contents across all 5 shells
Equivalents in every shell
ls -laWorked examples
List all files including hidden
ls -lals -laGet-ChildItem -Forcedir /aList only directories
ls -d */Get-ChildItem -Directorydir /adList sorted by modification time, newest first
ls -ltGet-ChildItem | Sort-Object LastWriteTime -Descendingdir /o-dGotchas
- PowerShell `ls` is an alias for `Get-ChildItem`, not the Unix binary — flags like `-la` will error.
- cmd `dir` formats output in column blocks; pipe through `more` to page on long listings.
- On Windows, `ls.exe` from Git Bash or WSL behaves like Unix `ls`; native cmd/PowerShell do not.
WSL & PowerShell Core notes
Common tasks using ls
- Count files in a directory
Get a count of files (excluding directories) in a folder — at depth 1 or recursively, with hidden files included or excluded.
- Diff two directories recursively
See which files exist only in one directory tree, which differ, and which are identical — for verifying a backup, comparing two checkouts, or spotting accidental changes.
- Find duplicate files by content
Identify files with identical contents across a directory tree (regardless of name) — for cleanup, deduplication, or media library audits.
- Find files by name
Locate files matching a glob pattern (e.g. `*.log`) anywhere under the current tree.
- Find files modified today
List every file changed in the last 24 hours, recursively from the current directory.
- Find symbolic links in a directory
List every symlink under a directory tree, optionally with their targets and broken-link detection.
- List empty directories
Find directories with no files — useful for cleanup, build-output verification, and detecting failed extractions.
- List files recursively
Print every file under a directory tree, optionally as a flat list of full paths.
- List the largest directories in a tree
Find the biggest directories anywhere in a tree (not just top-level immediate children) — for tracking down where a node_modules, log dir, or build artifact bloat is hiding deep in a project.
- Rename multiple files at once
Apply a rename rule (extension swap, prefix add, regex replace) to a batch of files in one shell-native pass — no GUI, no third-party tool.
- Show disk usage by folder
See which subdirectories consume the most disk space — for "where did 50GB go" investigations or post-clean audits.