From the course: Linux: Shells and Processes

Unlock the full course today

Join today to access over 24,500 courses taught by industry experts.

Pattern matching with globs

Pattern matching with globs - Linux Tutorial

From the course: Linux: Shells and Processes

Pattern matching with globs

- [Instructor] One of the reasons that manipulating files on the command line can be faster and more efficient than the GUI is file globbing. File globbing uses patterns containing wildcards to match files based on their names. For instance, if you wanted to list all filenames starting with the word file followed by any extension, you could use ls space file asterisk. This glob can be used with any command as the globbing is handled by the shell itself. You can practice the globs in this video using the files I've provided in this chapter's directory of the exercise files archive. The first wildcard we'll cover is the asterisk. An asterisk matches zero or more of any type of character. It matches everything and nothing. Let me explain. In this example, I'm using a glob of file asterisk. The asterisk would match the letters .txt, .jpg and .tar.gz, but it would also match a file named file. The reason for this is that file…

Contents