User Tools

Site Tools



Please Refer to Chapter 4 in the textbook, The Linux Command Line, for detailed discussion on wildcards. Today, we will just cover two types of wildcards, * and ?.

In addition to instructing the shell to perform operations on specific files or directories, we can use wildcards to ask the shell to perform operations on groups of filenames or directories with shared properties.

* will match any string of characters
? will match any individual character

:!: Exercise: What will the following commands do?

file1.txt file2.txt file100.txt dir1 dir2
$ls -d
dir1 dir2
$cp *.txt dir1
$cp file?.txt dir2

m( Common pitfall: rm and * are a dangerous combination. Please use care in removing items with wildcards and always use rm interactively.

Getting help

wiki/2016wildcards.txt ยท Last modified: 2016/08/24 20:27 by erin