Monday, December 16, 2024
HomeUNIXFind Files Using a Wildcard in UNIX

Find Files Using a Wildcard in UNIX

When you want to find all of the files matching a certain filename pattern, a wildcard can be used with the find command. Here are some examples to get you started.


To find all files ending with .html:

find / -name \*.html -print

The character causes the shell to ignore the following character, in this case an asterisk. To find a file that starts with project:

find / -name project\* -print

Multiple wildcards can be used in the same find command. The following command finds all files with the word maybe in it:

find / -name \*maybe\* -print

The backslash \ character is important. It tells the shell not to treat the wildcard character as a wildcard when interpreting the command line arguments.

Quinn McHenry
Quinn McHenry
Quinn was one of the original co-founders of Tech-Recipes. He is currently crafting iOS applications as a senior developer at Small Planet Digital in Brooklyn, New York.
RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Most Popular

LATEST REVIEWS

Recent Comments

error: Content is protected !!