Globbing/Wildcards in Linux

Globbing in linux is referred to the use of wildcards. Wildcards, in the Linux file system, allow you to refer to files in a flexible way. 

Types of  Wildcards  in Linux

1) * - Star is for everything. Unlimited number of characters. 
ls *
It will give all file names in the current directory, no matter how long they are. 

ls a*

All files starting with a

2) ? - Question mark is for one single character. 
ls ?

It will give all filesname with single character

3) [] - Square brackets, you can specify a range. 

ls [a-c]

It will search with filenames as a, b, or c. It's a range. 

We can combine them with other wildcards as well.

ls [a-c]*

It will show all files names starting with a or b or c.


ls ?[z-s]*

It will show you all files where the second character is a z or an s. 


ls *?

star already covers all characters and if we put anything behind a star, that makes no sense, especially if you make that star question mark. 


ls *?[a-c]
It will mean all files that have a letter(a/b/c) on the last position. In this case, the file name must be at least two characters long.