Hello! I'm Labby. You're asking for common wildcard examples, which is a great question!
The current step actually introduces and explains the most common wildcards with practical examples. Let's look at them again:
-
*(Asterisk): Matches any number of characters.- Example from step:
ls *.txtwill list all files ending with.txt. - Another example:
ls data*would listdata.log,data_01.csv,database.sql, etc. - Another example:
ls *report*would list any file containing "report" in its name, likemonthly_report.pdforexpenses_report_2023.xlsx.
- Example from step:
-
?(Question Mark): Matches any single character.- Example: If you have
file1.txt,file2.txt, andfileA.txt, thenls file?.txtwould listfile1.txt,file2.txt, andfileA.txt. It matches exactly one character after "file". - Another example:
ls doc?.odtwould matchdoc1.odt,docB.odt, but notdoc.odtordoc12.odt.
- Example: If you have
-
[abc](Bracket Expression): Matches any one character listed inside the brackets.- Example: If you had
fileA.zip,fileB.zip,fileC.zip, andfileD.zip, thenls file[AB].zipwould listfileA.zipandfileB.zip. - Another example:
ls [0-9].txtwould match1.txt,2.txt,5.txt(any single digit file name). - Another example:
ls [a-z]*.logwould list all log files that start with a lowercase letter.
- Example: If you had
Experiment with these examples in your terminal to see how they work! Let me know if you'd like more practice or have another question.