06. The Linux Command Line Ultimate Tutorial – WILDCARDs

Video is ready, Click Here to View ×

Wildcards, also know as globbing, provide a way to select a subset of files based on patterns of characters.

This is especially useful if you work with many files.

* – any number of any character.
? – any single character
[characters] – any character that is in the list [characters]
! – reverses the condition
[[:class:]] – any character that is a memnber of the class [:class:]

Most commonly used classes:

[:alpha:] alphabetic
[:alnum:] alphanumeric
[:upper:] uppercase


  1. I'm confused by the two latest examples !?
    Shouldn't FILE*[s1[:upper:]].txt display files which end up with "s" or "1" OR one uppercase character ? Instead it shows files which end up with "s" or "1" AND an additional uppercase character !?

  2. Hello ALU ! A good video but you forgot several important things.
    You didn't show the curly brackets wildcard like in ls file1.{txt,csv} if you had a file named file1.csv
    You haven't shown and explained the range wildcards like in ls [f-k]*.txt for any letter between f and k included. Or ls [2-5]*.txt for any digit between 2 and 5 included (you don't have by the way any file that matches this but it is for showing my point).
    You didn't say that globbing doesn't behave as expected within single and double quotes.
    Try echo *.txt then echo '*.txt' and then echo "*.txt" and see how it behaves.
    Best regards,

Leave a Reply

Your email address will not be published.