Filename Substitution

It is frequently convenient to use so-called wildcard characters when typing in a command line. As the name implies, a wildcard character is a character that stands for zero or more other characters.

* Matches zero or more characters.
? Matches any single character.
[] Defines a set of characters.
{} Defines a set of character sequences.
^ Can be used to negate character set definitions.

The most powerful of the wildcards is the Kleene star, '*', which is the shift of the 8 on your keyboard. It will match any character string of any length. For example, to display all files beginning with the letter t, use the following command:

ls t*

To remove all files ending with the .txt extension and beginning with the letter c, ...

Get Linux® Desk Reference, Second Edition 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.