$linuxjunkies
>

globbing

also: pathname expansion, wildcard expansion, glob expansion

Globbing is filename pattern matching that expands wildcard characters like * and ? into matching filenames directly in the shell before executing a command.

Globbing is performed by the shell (not by individual commands) to expand wildcard patterns into concrete filenames. Common glob patterns include * (matches any characters), ? (matches a single character), and [abc] (matches any character in the set). The shell expands these patterns and passes the resulting list of filenames to the command.

For example, ls *.txt expands the pattern *.txt into all files ending with .txt in the current directory, then passes them to ls. If no files match, most shells pass the pattern literally (which typically causes an error).

Globbing differs from regular expressions—glob patterns are simpler and used for filenames, while regex is more powerful and used for text matching. You can disable globbing with set -f or quote patterns like '*.txt' to pass them literally to a command.

Related terms