Using globs

* unquoted asterisk character on a command line has a special meaning to Bash: it means it should expand the word in which the character occurs to all of the matching filenames if possible, but (by default) to leave the word unchanged if there are no such matching files.

This can be confusing, and is best explained with a few examples. Suppose our current directory has the following filenames:

$ ls -a
.  ..  .bashrc  april  august  october  september

A glob by itself will expand to all the filenames that are not prefixed with a dot:

$ printf '%s\n' *
april
august
october
september

Note that the filenames are expanded in alphabetical order  or, more correctly, the order specified by your language environment's collation settings. ...

Get Bash Quick Start Guide now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.