Filename globbing in Linux: wildcards and *
Updated July 3, 2026
Globbing is the shell's expansion of patterns like * into a list of matching filenames.
Common cases
ls *.txt # every name ending in .txt
ls file?.log # ? is exactly one character
ls [ab]*.conf # names starting with a or b
rm *.tmp # check the pattern with ls firstHow it works: the shell expands the pattern, not the command
The shell expands a glob BEFORE the command runs:
rmseesrm *.tmpasrm a.tmp b.tmp. So if nothing matches, most shells pass the pattern through literally.*matches any sequence of characters (but not the leading dot of a hidden file),?matches exactly one character, and[...]matches one character from the set. To let a command do the matching itself (asfind -namedoes), you quote the pattern.
Used in
You need this in the lesson Files and directories. The theory is the chapter Files and directories.
See also
mkdir, cp, mv, rm, The ls command, The find command.
Try it
Open the sandbox: a real throwaway Linux terminal in your browser. Run the commands above by hand - the container is deleted when you leave.