1.globing
文件名通配——一种匹配模式,整体文件名匹配,而非部分匹配!
2.匹配模式
能实现对多个文件名同时进行匹配(如etc下所有以p开头的目录)
[root@localhost ~]# ll -d /etc/p*
drwxr-xr-x. 2 root root 4096 7月 13 09:35 /etc/pam.d
-rw-r--r--. 1 root root 1316 7月 17 20:04 /etc/passwd
-rw-r--r--. 1 root root 1279 7月 17 08:21 /etc/passwd-
drwxr-xr-x. 3 root root 20 7月 13 09:31 /etc/pkcs11
drwxr-xr-x. 9 root root 91 7月 13 09:32 /etc/pki
drwxr-xr-x. 2 root root 27 7月 13 09:32 /etc/plymouth
drwxr-xr-x. 5 root root 49 7月 13 09:31 /etc/pm
drwxr-xr-x. 5 root root 69 7月 13 09:32 /etc/polkit-1
3.通配符的元字符
*:匹配任意长度的任意字符
[root@localhost ~]# ll -d /etc/p*
drwxr-xr-x. 2 root root 4096 7月 13 09:35 /etc/pam.d
-rw-r--r--. 1 root root 1316 7月 17 20:04 /etc/passwd
? : 匹配任意单个字符
[root@localhost ~]# ll -d /etc/p?
drwxr-xr-x. 5 root root 49 7月 13 09:31 /etc/pm
[] : 匹配指定范围内任意单个字符,有以下几种情况
第一种表达式
[a-z]:所有的小写字母
[A-Z]:所有的大写字母
[0-9]:数字
[a-z0-9]:字母和数字
[root@localhost ~]# ls /bin/p[0-9]*
/bin/p11-kit
第二种表达式
[[:upper:]]:表示所有大写字母
[[:alnum:]]:表示所有字母和数字
[[:alpha:]]:表示所有字母
[[:digit:]]:表示所有数字
[[:lower:]]:表示所有小写字母
[[:punct:]]:表示所有标点符号
[[:space:]]:表示所有空白字符
注意:上面式子仅仅只能表示一位通配符,如有多 为则写多个格式
[root@localhost ~]# ll /bin/p[[:alpha:]]*
-rwsr-xr-x. 1 root root 27832 6月 10 2014 /bin/passwd
-rwxr-xr-x. 1 root root 33080 11月 20 2015 /bin/paste
-rwxr-xr-x. 1 root root 33056 11月 20 2015 /bin/pathchk
-rwxr-xr-x. 1 root root 428600 6月 10 2014 /bin/pgawk
-rwxr-xr-x. 1 root root 28320 3月 6 2015 /bin/pgrep
-rwxr-xr-x. 1 root root 184736 6月 10 2014 /bin/pic
-rwxr-xr-x. 1 root root 2237 1月 31 2014 /bin/pinentry
-rwxr-xr-x. 1 root root 50328 6月 10 2014 /bin/pinentry-curses
-rwxr-xr-x. 1 root root 44896 11月 21 2015 /bin/ping
-rwxr-xr-x. 1 root root 49568 11月 21 2015 /bin/ping6
-rwxr-xr-x. 1 root root 37416 11月 20 2015 /bin/pinky
-rwxr-xr-x. 1 root root 88880 11月 20 2015 /bin/pk12util
[^] :匹配指定范围内以外的任意单个字符
[root@localhost ~]# ll /bin/p[^[:alpha:]]*
-rwxr-xr-x. 1 root root 28680 3月 6 2015 /bin/p11-kit
4.快捷键
Ctrl+a:跳转至命令首行
Ctrl+e:跳转至命令行尾
Ctrl+u:删除命令首行到光标处之间所有字符
Ctrl+k:删除光标到行尾之间的所有字符
Ctrl+L:清屏
Ctrl+c:终止命令