So far, you haven’t really seen any ways that the terminal can be much more powerful than a GUI file browser that you’re used to. However, as we’ll see in this lesson, you can combine some basic features of Bash with the commands you already know to quickly do things that would have been hard to do otherwise.
Part of Bash’s power comes from its ability to carry out file name expansion in a process known as “globbing”. Globbing is a process whereby certain special “wildcard” symbols are expanded into a matching set of filenames.
This page has a great list of examples and wildcards that bash can expand. For this class, though, you only need to know the following:
||Matches any characters in a filename|
||Matches a single character in a filename|
||All file in the current directory|
||All files ending in
||All files containing
||All files in the parent directory|
||All files starting with
Using an exclamation point (
!) in bash can be tricky, because it’s actually a
bash special character.
You can get around this either by using single quotes (
'...') or by escaping
the exclamation point (
Note: We discuss the differences between the types of bash strings in this lesson.
Bash will expand certain expressions inside curly braces (
}) into multiple arguments. These are called ranges. Unlike other globbing,
ranges expand whether or not a file actually exists whose name matches the
To refer to a file whose name contains a literal
* or other special
characters, wrap the filename in single quotes.