glob
Glob is a pattern-matching syntax used for filename expansion in many Unix-like systems and programming languages. The term is short for global pattern matching, describing a lightweight way to select files or paths without regular expressions. Globbing originated in early shells as a simple mechanism for pathname expansion.
Common glob characters include:
- , which matches any string of characters within a single path component
- ? , which matches exactly one character
- [sequence], which matches any one character in the listed set
- [!sequence], which negates the set
Character ranges like [a-z] are supported in many implementations. Glob patterns typically operate on path components,
Different environments extend basic globs. Bash, for example, supports the globstar option () for recursive matching and
Globbing is implemented in shells (e.g., Bash, Zsh), as well as in standard libraries and language runtimes.
- .txt matches all text files in the current directory
- data/.csv matches CSV files within the data directory
- /.py (when supported) matches Python files across subdirectories