Skip to main content

Perform Basic File Management – Part 1

Simple and Advanced Wildcard Specifications in Commands

In this lesson, you’ll master wildcard (glob) patterns in Linux to search, copy, move, or delete files efficiently. Wildcards are symbols that stand for one or more characters in file names or paths. We’ll cover three primary types:
  • Asterisk (*)
  • Question mark (?)
  • Bracketed expressions ([ ])
The image explains types of wildcards: asterisk (*) for zero or more occurrences, question mark (?) for a single occurrence, and brackets ([]) for specific character occurrences, with an example of [0-9] matching all digits.

Wildcard Reference Table


1. Asterisk (*)

The asterisk is the most flexible wildcard—it matches any string of characters (even an empty string).
In interactive shells, wrap * patterns in quotes (e.g., "*.png") to prevent premature expansion by your shell.
You can use multiple asterisks in a single pattern, at any position:

2. Question Mark (?)

The question mark matches exactly one character. It’s ideal for pinpointing files that differ by a single letter or digit.

3. Bracketed Characters ([ ])

Square brackets let you match one character from a specified set or range.
Combine multiple bracket sets for more control:

4. Combining Wildcards

For advanced file matching, mix wildcards in a single pattern:
Another practical example:
Be cautious when using wildcards with destructive commands like rm. Always double-check your pattern with ls before deletion.

That concludes Part 1 of wildcard specifications. In the next lesson, we’ll dive deeper into escape sequences and advanced glob qualifiers.

Watch Video