Sometimes we just don’t know what we want! Wildcards can be thought of as a way of searching multiple options at the same time and returning all the results together. So if we want to search for all files in our /home/pi/files directory that start with f, we can just type:
file1 file2 file3 file4 file5
The wildcard * has a specific meaning of nothing or a string of characters of any length. So a search for f* would also return a file called f if it existed in our directory. Likewise a file called floccinaucinihilipilification (the action or habit of estimating something as worthless) would be returned if present.
To search for all files which have a 1 as their final character we can use:
blank1 file1 text1
Wildcards work with many different programs that can accept multiple files in their input, so for example we can check out the file types of all files ending with a 1 using:
file1: ASCII text
text1: ASCII text
If we want to search for files with the prefix of text, then we can use the ? wildcard which will match any single character.
text1 text2 text3 text4 text5
To search for files that have 4 characters followed by the number 1 we can use:
Finally using brackets we can specify specific matches or ranges. So to find all files with a prefix of file and an ending between 1 and 3:
file1 file2 file3
Multiple options can be specified with commas within the brackets (e.g. [1-3,7-9]), include ranges of letters (e.g. [a-z] or [A-Z]), or be combined to specifiy for example just letters and numbers [a-z,A-Z,0-9].