Home UNIX Find 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.

LEAVE A REPLY

Please enter your comment!
Please enter your name here

error: Content is protected !!