Chapter 4. Filename substitution

When working on the command line, quite a bit of your time will be spent locating files that you want to work with. The shell offers a neat set of pattern matching or metacharacters that enables you to match filenames based on the pattern you supply. You can also use character classes to match filenames. But as it’s quicker using the metacharacters on the command line, we will stick with these in this chapter.

In this chapter we will cover:

  • pattern matching using any character string;

  • pattern matching using single characters; and

  • pattern matching using alpha or numeric characters.

Here are these special characters.

* Matches any string including a null string.
? Matches any one character.
[...] Matches any characters ...

Get Linux and Unix Shell Programming 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.