WildCards (Globbing) in files in Linux

Wildcards are used to match multiple files.

For example –

abc* – Here * will match all files that start with abc

abc[pqr] – here square bracket will match any file that starts with abc and ends with p or q or r

abc? – here ? will match just single character. It will match all files that start with abc and end with any other character.

BASH will expand the file names using wild cards.

Difference between WildCards (Globbing) and Regular expressions

It is worth noting that even though wildcard characters are same as meta characters in regular expressions, they are completely different.

For example –

abc* – If used as wildcard, it will match all files starting with abc. But if used as regular expression, it will match ab, abc, abcccc etc.

 

 

You may also like...