Skip to main content

Globbing means matching files by name patterns containing wildcards.

You can specify a set of files matching a certain glob pattern using wildcard characters, e.g. cp *.txt /directory. This is handled by the shell, so it is available on the command line no matter what program you are starting. Conversely, if you need to pass one of the wildcard characters to a command, it must be quoted, e.g. rsync -a --exclude='*.bak' /source /destination.

Globbing is known by various names accross shell documentations: filename generation, pathname expansion, pattern matching, wildcard matching… Advanced shells such as , and implement additions to the basic glob patterns. These additions make wildcards as expressive as regular-expressions , but with a different syntax. There are other programs, such as , that use a similar wildcards syntax to match files by name.

For more complex tasks such as matching files in subdirectories recursively or matching files by metadata such as date or size, try .


Further reading