IT lexicon › Programming › Glob

Glob

Programming På svenska → Updated: 2026-08-01

Pattern matching for filenames: *.txt, photo_?.jpg, src/**/*.js.

The name comes from /etc/glob, a small helper binary in early Unix that the shell called out to for wildcard expansion before it learned to do the job itself. The program is long gone; the name survived and turned into a verb.

The syntax is deliberately far less expressive than regex: * matches zero or more characters except a slash, ? matches exactly one, [abc] is a character class and {a,b} gives alternation (a bash extension). The recursive ** came later still and behaves annoyingly differently across bash, zsh, Python and npm. The thing that trips people up in shell scripts: the shell expands the pattern, not the program — and if nothing matches, most shells pass the pattern through verbatim.

← Back to the lexicon