From the course: Linux CentOS 7: Files and Permissions

Unlock the full course today

Join today to access over 22,600 courses taught by industry experts or purchase this course individually.

Pattern matching using globs

Pattern matching using globs - Linux Tutorial

From the course: Linux CentOS 7: Files and Permissions

Start my 1-month free trial

Pattern matching using globs

- [Instructor] One of the reasons that manipulating files on the command line can be faster and more efficient than the GUI is pattern matching. In BASH pattern matching is called file globbing and all commands can use it. File globs allows to match patterns for instance, if you wanted to list config files we can match files ending in dot C-O-N-F by using an asterisk. So we'd type in L-S space slash E-T-C slash asterisk dot C-O-N-F. An asterisk matches any type of character and any number of them. So file dot asterisk would match any word that starts with file has a dot in it and is followed by any number of characters. A question mark matches any type of character but only one of them. So file question mark dot T-X-T would match file a dot T-X-T and file one dot T-X-T. If you want to match two characters you're going to have to include two question marks. We can match a range or a list of characters with a set using square brackets. Each set matches exactly one character, but that…

Contents