Globs & Braces in Bash
From the Bash Scripting cheat sheet · Globbing & Brace Expansion · verified Jul 2026
Globs & Braces
Match files and generate strings.
bash
# Quick Reference
*.txt # any name ending .txt
file?.log # single-char wildcard
{a,b,c} # brace expansion -> a b c
{1..5} # sequence -> 1 2 3 4 5💡 Globs match existing files; brace expansion just generates text (files need not exist).
⚡ Enable ** recursive matching with shopt -s globstar.
📌 By default an unmatched glob stays literal - set shopt -s nullglob to get nothing instead.
🟢 mkdir -p base/{a,b,c} is a quick way to create several directories at once.
globbingbrace-expansion