Wildcarding allows you to specify groups of files. You can
use wildcards as an argument to ls, cp,
mv, and rm, as well as to UNIX
filters.
| Wildcard | What it Represents |
|---|---|
| ? | any character |
| * | any glob of zero or more characters |
| [crmf] | any of c, m, r or f. You can put any list of caracters in the brackets to create a wildcard. |
| [a-z] | any charcter falling asciicograpically from a to z. You can put any range of characters you wish in here and you can have more than one range. |
Here are some useful examples and what they do.
ls *.htmlList all HTML files in your cwdls */index.htmlList any file nameadindex.htmlin any immediate subdirectory of your cwdgrep -l cos *.cList all.cfiles that contain the string "cos" in your current working directory.cat *f* |grep -i washingtonPut all lines from files containing the letter f in your cwd that contain the word "washington" case-insensitive tostdout.ls [a-f][q-z]*.htmlThis lists all files starting with a lower-case letter a-f then a lower case letter q-z followed by any other characters which have a.htmlextension.- (desperation search)
grep -il */* regalisPrint the names of all files one folder down that contain the text stringregalis, case insensitive. Where'd I put those notes???