Using Wildcards

You might think of wildcards as being placeholders for omitted letters or numbers. For example, if you’re looking for a file but aren’t sure whether you named it kidnews or kidupdate, you can include a wildcard to stand for the part you’re uncertain of. That is, you could list the files of a directory with ls kid* (Code Listing 1.7), which would list all files starting with the characters “kid”. In the resulting list, you’d find a file named kid if there were one, as well as files that begin with kid but have varying endings, such as kidnews (aha, the lost file!), kiddo, or kidneypie.

Code Listing 1.7. You use wildcards (? or *) to act as placeholders for missing characters.
[jdoe@frazz Project]$ ls keep keeper.jpg keptkidder.txt ...

Get Unix Third Edition: Visual Quickstart 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.