--- tags: - linux --- https://linux.die.net/man/7/glob **Wildcards** - \*: any str, including empty - ?: any single char **Character classes** are wrapped with []. First char can't be ! and it can't be empty. Thus to match [ ] and ! we need to wrap them like so `[][!]` **Ranges** two chars separated by `-`. **Complementation** `[!..]` match any chars not in the character class. **Pathnames** globbing applies to component seperately. `/` not allowed in character classes. Wildcards don't match `/`. Dot files must be explicitly matched, thus `*` will not match it. **Empty lists** A wildcard can expand into an empty list (e.g `*.gif` where no .gif exist). If the wildcard expands to an empty list or is invalid it will remain unchanged per POSIX specifications. In bash `shopt -s nullglob` enables expanding into an empty list. ### Difference with Regular Expressions With globbing we match filenames rather than text.