Metacharacter | Meaning |
* | Match any string of zero or more characters |
? | Match any single character |
[abc...] | Match any one of the enclosed characters; a hyphen can
specify a range (e.g., a-z, A-Z, 0–9) |
[!abc...] | Match any character not enclosed as above |
~ | Home directory of the current user. |
~name | Home directory of user name |
~+ | Current working directory ($PWD) |
~- | Previous working directory ($OLDPWD) |
ls
-----------------------------
a apple b banana c case d duck
prompt> ls a*
a apple
prompt> ls a????
apple
prompt> ls [a-c]
a b c
prompt> ls [!a-c]
d
prompt> shopt -s extglob
ls
-----------------------------
te11te te12te te1te te21te te22te te2te
prompt> ls te?(1|2)te
te1te te2te
prompt> ls te*(1|2)te
te11te te12te te21te te22te
prompt> ls te+(1|2)te
te11te te12te te1te te21te te22te te2te
prompt> ls te@(1|2)te
te1te te2te
ls
-----------------------------
a apple b banana c case d duck
prompt> ls !(apple|b)
a banana c case d duck touch
ls
-----------------------------
a apple b banana c case d duck
prompt> ls [[:alnum:]]pple
apple