Tagged with: CCCCCC linux wildcard character style
#文件名通配
Wildcard characters:
*: matches any character of any length (0 to more)
[[Email protected]_168_102_centos ~]# ls *08120808082014-05-16~]# ls-ld t*drwxr-xr-x 2 root Wanghan 40 15:46 Test
? : Matches any single character
[[Email protected]_168_102_centos ~]# ls 0812080808 2014-05-16 ceshi_1 test [[email protected]_168_102_centos ~]# ls tes? [[email protected]_168_102_centos ~]# ls-ld tes? drwxr -xr-x 2 root wanghan 4096-15:46 test[[ Email protected]_168_102_centos ~]# ls-ld t? stdrwxr -xr-x 2 root wanghan 4096 15:46 test[[ Email protected]_168_102_centos ~]# ls-ld t??? drwxr -xr-x 2 root wanghan 4096 15:46 test[[ Email protected]_168_102_centos ~]# ls-ld t?? Ls:cannot access t ??: No such file or directory
[]: matches any single character within the specified range of characters
[[Email Protected]_168_102_centos ~]# ls-ld *[abc]drwxr-xr-x 2 root wanghan 4096] 10:32 abcdrwxr - Xr-x 2 root Wanghan 4096 10:32~]# ls-ld *[ac]drwxr-xr-x 2 root wanghan 4096-10:32 >~]# ls-ld [abc]*drwxr-xr-x 2 root wanghan 4096 10:32 abcdrwxr-xr-x 2 root Wanghan 4096 12 1 0:32 abddrwxr-xr-x 2 root wanghan 4096-10:32 Abe
[A-z]: all lowercase letters
[Email protected]_168_102_centos ~]# lsabc ABC abd Abe ~]# ls-ld *[a-z]drwxr- Xr-x 2 root Wanghan 4096 10:32 abcdrwxr-xr-x 2 root wanghan 4096 10:32 abddrwxr-xr-x 2 Roo T Wanghan 4096 10:32 abedrwxr-xr-x 2 root wanghan 4096-10:32 Xab
[[: Lower:]]: All lowercase letters
[[Email Protected]_168_102_centos ~]# ls-ld *[[: Lower:]]drwxr-xr-x 2 root wanghan 4096] 10:32 abcdr Wxr-xr-x 2 root wanghan 4096 (10:32 abddrwxr -xr-x 2 root wanghan 4096) 10:32 abedrwxr 13>-xr-x 2 root Wanghan 4096 10:32 Xab
[A-Z]: all uppercase letters
[Email protected]_168_102_centos ~]# lsabc ABC abd Abe ~]# ls-ld *[a-z]drwxr- Xr-x 2 root Wanghan 4096 10:32 ABC
[[: Upper:]]: All uppercase letters
[[Email Protected]_168_102_centos ~]# ls-ld * [: Upper:]]drwxr-xr-x 2 root wanghan 4096-10:32 ABC
[[: Alpha:]]: All letters, case insensitive
[[Email Protected]_168_102_centos ~]# ls-ld *[[: Alpha:]]drwxr-xr-x 2 root wanghan 4096] 10:32 abcdrwxr -xr-x 2 root wanghan 4096 10:32 abcdrwxr-xr-x 2 root wanghan 4096 10:32 abddrwxr-xr-x 2 root Wanghan 4096 10:32 abedrwxr-xr-x 2 root wanghan 4096-10:32 Xab
[0-9]: all numbers
[Email protected]_168_102_centos ~]# ls123 ABC ABC abd Abe ~]# ls-ld *[0-9 ]drwxr-xr-x 2 root 4096 wanghan 10:50123 ~]# ls-ld *[23]drwxr-xr-x2 root Wanghan 4096 12 10:50 123
[[Digit:]]: All numbers
[[Email Protected]_168_102_centos ~]# ls-ld *[[:d igit:]]drwxr-xr-x 2 root wanghan 4096 12 10:50 123
[[: Alnum:]]: All numbers and letters, letters not case
[[Email Protected]_168_102_centos ~]# ls-ld *[[: Alnum:]]drwxr-xr-x 2 root wanghan 4096] 10:50 123 drwxr -xr-x 2 root wanghan 4096 10:32 abcdrwxr-xr-x 2 root wanghan 4096 10:32 abcdrwxr-xr-x 2 root Wanghan 4096 10:32 abddrwxr-xr-x 2 root wanghan 4096 10:32 abedrwxr-xr-x 2 root WA Nghan 4096 10:32 Xab
[[: Space:]]: space
[[Email protected]_168_102_centos ~]# ls123 ABC a c ABC abd Abe ~]# ls-ld **~]# ls-ld *[[:space:]]*drwxr-xr-x 2 root Wanghan 4096 in 11:13 a C
[[:p UNCT:]]: punctuation
[[Email protected]_168_102_centos ~]# ls,,1 123 ABC a c ABC Abd Abe ~]# ls-ld [[:p unct:]]*drwxr-xr-x 2 root wanghan 4096 12 11:16, 1
[^]: matches any single character outside the specified range of characters
[^0-9]: In addition to the number
[[Email protected]_168_102_centos ~]# ls,,1 123 ABC a c ABC abd Abe ~]# ls-ld *[^0-9]drwxr-xr-x 2 root wanghan 4096 10:32 abcdrwxr-xr-x 2 root Wanghan 4096 12 11:13 a cdrwxr-xr-x 2 root wanghan 4096 10:32 abcdrwxr -xr-x 2 root wanghan 4096 12 10:32 abddrwxr-xr-x 2 root wanghan 4096 (10:32 abedrwxr -xr-x 2 root wanghan 4096) 10:32 Xab
[^[:upper:]]: In addition to capital letters
[[Email protected]_168_102_centos ~]# ls-ld *[^[:upper:]]drwxr -xr-x 2 root Wanghan 4096 11:16, 1drwxr -xr-x 2 root wanghan 4096-10:50 123
drwxr -xr-x 2 root wanghan 4096 11:13
a cdrwxr -xr-x 2 root Wanghan 4096 10:32
abcdrwxr -xr-x 2 root wanghan 4096 12 10:32< Span style= "COLOR: #000000" > abddrwxr -xr-x 2 root wanghan 4096 10:32
abedrwxr< /span>-xr-x 2 root Wanghan 4096 10:32 Xab