From the course: Cert Prep: LPIC-1 Exam 101 (Version 5.0)

Unlock the full course today

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

File globbing and parameter expansion

File globbing and parameter expansion - Linux Tutorial

From the course: Cert Prep: LPIC-1 Exam 101 (Version 5.0)

Start my 1-month free trial

File globbing and parameter expansion

- [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 allow us to match patterns. For instance, if we wanted to list config files, we could match files ending in .conf by using an asterisk. So we type in ls space slash etc slash asterisk .conf. An asterisk matches any type of character and any number of them. So file.* 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?.txt would match filea.txt and file1.txt. 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…

Contents