Pattern matching is one of the shells most powerful features. The Bash shell allows us to match files based on certain patterns. Using the asterisk and sets we can match most files. Using character classes we can also match based upper and lower case as well as types of punctuation.
- [Narrator] 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'd type in…ls /etc/*.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 could match a range or a list of characters…with a set using square brackets.…Each set matches exactly one character,…but that one character can be any of the items…in the range or list.…
By placing a hyphen between the start…and ending characters, we can create a range.…
- Write the command that will take you to the most recent directory.
- Write the command that brings back the arguments and options from the previous line.
- Explain what extended globs can do.
- Identify the access.conf line that will restrict all users from using the cron service except for the user named bob.
- List the line that will get a list of only running services.
- Identify what typing ‘systemctl enable crond’ will do.
Skill Level Intermediate
Linux: User and Group Managementwith Grant McWilliams1h 8m Intermediate
1. Linux Shells Overview
2. Using the Bash Shell
3. Linux Processes
4. Job Scheduling
5. System Services
- Mark as unwatched
- Mark all as unwatched
Are you sure you want to mark all the videos in this course as unwatched?
This will not affect your course history, your reports, or your certificates of completion for this course.Cancel
Take notes with your new membership!
Type in the entry box, then click Enter to save your note.
1:30Press on any video thumbnail to jump immediately to the timecode shown.
Notes are saved with you account but can also be exported as plain text, MS Word, PDF, Google Doc, or Evernote.