Find files by name
Locate files matching a glob pattern (e.g. `*.log`) anywhere under the current tree.
How to find files by name in each shell
Bashunix
find . -name "*.log"`-name` matches the basename only and is case-sensitive on Linux. Use `-iname` for case-insensitive.
Zshunix
find . -name "*.log"Fishunix
find . -name "*.log"PowerShellwindows
Get-ChildItem -Recurse -Filter *.log`-Filter` is much faster than `-Include` because the FileSystem provider applies it; `-Include` filters client-side after enumeration.
cmd.exewindows
dir /s /b *.logEquivalents listed for Bash, Zsh, Fish, PowerShell, cmd.exe.
Gotchas & notes
- `find -name` is **case-sensitive** on Linux ext4/xfs but typically case-insensitive on macOS HFS+/APFS — the filesystem decides, not `find`.
- PowerShell `-Filter` accepts a single wildcard expression. For multiple patterns, use `-Include *.log,*.txt` (slower) plus `-Recurse`.
- cmd `dir /s /b *.log` is the natural twin of `find . -name '*.log'` — same recursion, same wildcard, but no symlink awareness on Windows.
- For regex matching of filenames, switch to `find . -regex '.*\.lo[gG]$'` (bash) or `Get-ChildItem -Recurse | Where-Object Name -match '\.log$'` (PowerShell).