Wildcards are a set of building blocks that allow you to create a pattern defining a set of files or directories.

Here is the basic set of wildcards:

  • * – represents zero or more characters
  • ? – represents a single character
  • [] – represents a range of characters


 Wildcards may be used with any command.


in Linux

It represents zero or more characters. If you want to list all the files and directories then this wildcard is very beneficial.In simple words, whenever you use * means it will include all the character.

ls * 

E.g.  if you want to list all the directory which starts with D. Then you just have to write.

ls D*

it will list all the directories and files of those directories which starts with D.


wildcard in linux - ls D*

suppose you want to search all files with extension png.

ls path *.png

Here path is from where you want to list all png.

search files


? in Linux

it represents one character. This wildcard is used as a filter like if you want to search a directory whose second letter is o or whose extension is of 3 words.. etc. It is mainly used with * wildcard.

? wildcard

it means list all the file whose first letter is an unknown but second character is o and i do not care about remaining characters in the file name.

wildcard in linux

it means I do not care about the file name. I care about extension only whose length consists of 3 characters.

[] in Linux

It represents the range of characters. so, it is also called range operator.

suppose you want to see all files or folders whose name starts with M, V and f.

[] wildcard

or you want to list all files which is in range between A-F.

range operator in linux


i guess you got the basic understanding about wildcard.


Please enter your comment!
Please enter your name here