p>File globbing also known as Path Name Expansion. It is the method of recognizing wildcard patterns in linux and then finding the file path expansion based on these patterns.
Wildcard Patterns are strings that are used for selection of multiple files based on patterns.
The character patterns like “?” , “[ ]” , “*” are used for pattern matching and multiselection of the files.
Example of wildcard characters using in file globbing:
For example: file* will match all files with name file, files, file2, or with anything after file.
For example: file* will match filename file1, but not file01 or file.
For example: file will match all filenames with exactly 2 more characters at the end like file01 but not file1 or file211.
File[1- 3] will match all filenames with 1, 2 or 3 more characters at the end. Like file1, file01, file211 but not more than that.
One more additional thing that can be inside the brackets is the negation of a specific count, it is done using ! or exclamation mark, this excludes the count instead of the specific number of characters.
For example: file[!2] will match all file names which have extra characters elser than 2. Like file1, file211 but not file01.
Here is how to implement these in linux commands −
We have created some files in a folder −
file , file1, file01, file211, files.
Then used all globbing patterns on it. Here is the result −