WildcardsWildcards are extremely useful when you are dealing with files and directories. The process of matching expressions containing wildcards to file names is wildcard expansion or globbing.
Lesson 4 | Lesson 6
Create a test directory, move into the test directory and then execute this command.touch {tree,rock,dirt}_{asia,us,ca}_{fall,winter,spring,summer}Examples:List all files with the _fall ending.ls *_falldirt_asia_fall dirt_us_fall rock_ca_fall tree_asia_fall tree_us_falldirt_ca_fall rock_asia_fall rock_us_fall tree_ca_fall List all files that start with r or t.ls [rt]*rock_asia_fall rock_ca_summer tree_asia_fall tree_ca_summerrock_asia_spring rock_ca_winter tree_asia_spring tree_ca_winterrock_asia_summer rock_us_fall tree_asia_summer tree_us_fallrock_asia_winter rock_us_spring tree_asia_winter tree_us_springrock_ca_fall rock_us_summer tree_ca_fall tree_us_summerrock_ca_spring rock_us_winter tree_ca_spring tree_us_winterList all files that do not start with r or t.ls [!rt]*dirt_asia_fall dirt_asia_winter dirt_ca_summer dirt_us_springdirt_asia_spring dirt_ca_fall dirt_ca_winter dirt_us_summerdirt_asia_summer dirt_ca_spring dirt_us_fall dirt_us_winterList all files that start with dirt followed by one letter and then have the text string ca followed by any amount of letters.ls dirt?ca*dirt_ca_fall dirt_ca_spring dirt_ca_summer dirt_ca_winter
BeginLinux.com(406)-827-4648mike at beginlinux.com