I am using the following command to find a directory name.
find / -type d -name "ora10"
My problem is, I am not sure what the exact directory name is, so I would like to find directories similar to "ora10g"
, "ora10client"
, etc.
How can I do this with find?
You can use your own wildcards to limit search results. You can use a question mark (?) as a wildcard for a single character and an asterisk (*) as a wildcard for any number of characters. For example, *. pdf would return only files with the PDF extension.
Wildcard character is a special character that represents one or more other characters. Wildcard characters are often used when you do not know the exact name of file/folder or you do not want to type the entire name. There are two wildcard characters: asterisk (*) and question mark (?).
When you have a number of files named in series (for example, chap1 to chap12) or filenames with common characters (like aegis, aeon, and aerie), you can use wildcards (also called metacharacters) to specify many files at once. These special characters are * (asterisk), ? (question mark), and [ ] (square brackets).
The wildcard '*' means it will match any number of characters or a set of characters. For example, S**n will match anything between S and n. The number of characters between them do not count. Syntax: ll A*f.
find supports wildcard matches, just add a *
:
find / -type d -name "ora10*"
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With