find — Locate files by name, size, time, or other attributes across all 5 shells
Equivalents in every shell
Worked examples
Find files modified in the last day
find . -mtime -1Get-ChildItem -Recurse | Where-Object { $_.LastWriteTime -gt (Get-Date).AddDays(-1) }forfiles /s /d -1 /c "cmd /c echo @path"Find files larger than 100MB
find . -size +100MGet-ChildItem -Recurse | Where-Object { $_.Length -gt 100MB }Find and delete files by pattern
find . -name "*.tmp" -deleteGet-ChildItem -Recurse -Filter *.tmp | Remove-Itemdel /s *.tmpGotchas
- Confusingly, Windows has its own `find` command that searches *within* files (like grep), not for files. Use `where` or `dir /s` for filename search.
- `Get-ChildItem -Filter` is much faster than `-Include` because filtering happens at the provider level.
- GNU find supports `-printf`; BSD find (macOS pre-Sonoma) does not — use `-print` and `awk` for formatting.
WSL & PowerShell Core notes
Common tasks using find
- Clean untracked files from a git repo
Delete files that git doesn't know about (build artifacts, scratch files, `.DS_Store`, `node_modules`) — the destructive sibling of `git restore`. ALWAYS dry-run first; there is no reflog recovery.
- 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.
- Delete files older than 30 days
Remove files whose last-modified time is more than 30 days ago, recursively.
- 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 a process by its current working directory
Locate which PIDs have a specific directory as their CWD — for unmounting a busy filesystem, debugging "device busy" errors, or auditing what is running out of a particular path.
- Find broken symlinks
List symlinks whose target no longer exists — useful for post-uninstall cleanup, package-manager state, and orphaned-dotfile detection.
- 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 by permission bits
Search a directory tree for files matching specific permission bits — world-writable files for a security audit, SUID/SGID binaries for a post-CVE sweep, or files with exactly `0644` to verify a deployment.
- Find files larger than 100MB
List files exceeding a size threshold — useful for cleanup, quota enforcement, and identifying log-rotation gaps.
- 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.
- Find the largest files in a directory
Identify the top N largest files under a directory tree, sorted by size.
- Grep recursively with context lines
Search a directory tree for a pattern and print N lines of surrounding context for each match — for code archaeology, log spelunking, or config-file forensics.
- 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.
- Replace a string across multiple files
Apply the same find-and-replace operation to a batch of files (filtered by glob, by content, or by recursion) — for renaming an API, fixing a typo across a codebase, or updating a config value.
- Run a command when a file changes
Auto-execute a build / test / reload step the moment a watched file is saved — the dev-loop primitive behind every "live-reload" tool, without committing to a specific framework.
- Show disk usage by folder
See which subdirectories consume the most disk space — for "where did 50GB go" investigations or post-clean audits.