* 匹配零个或多个字符
列出/dev下所有以l开头的文件或目录
[root@localhost ~]# ls /dev/l*
/dev/log /dev/loop-control /dev/lp0 /dev/lp1 /dev/lp2 /dev/lp3
? 匹配任何单个字符
[root@localhost ~]# ls
aaa anaconda-ks.cfg f1 f2 f3 f4 f5 f6
[root@localhost ~]# ls f?
f1 f2 f3 f4 f5 f6~ 当前用户家目录
~username 用户家目录
~+ 当前工作目录
~- 前一个工作目录
[0-9] 匹配一个数字范围
[root@localhost ~]# ls
aaa anaconda-ks.cfg f1 f2 f3 f4 f5 f6
[root@localhost ~]# ls f[1-3]
f1 f2 f3[a-z] :大写和小写字母
[root@localhost ~]# ls
aaa f1 f3 f5 fa fb fc fd fe ff
anaconda-ks.cfg f2 f4 f6 fA fB fC fD fE fF
[root@localhost ~]# ls f[a-z]
fa fA fb fB fc fC fd fD fe fE ff fF
[A-Z] :大写字母
[root@localhost ~]# ls
aaa f1 f3 f5 fa fb fc fd fe ff
anaconda-ks.cfg f2 f4 f6 fA fB fC fD fE fF
[root@localhost ~]# ls f[a-z]
fa fA fb fB fc fC fd fD fe fE ff fF
[root@localhost ~]# ls f[A-Z]
fA fb fB fc fC fd fD fe fE ff fF
[a-z][A-Z]都显示大小写。
[wxc] 匹配列表中的任何的一个字符
[root@localhost testdir]# ls
fa fb fc fd ff fs
[root@localhost testdir]# ls -d f[abhgc]
fa fb fc
[^wxc] 匹配列表中的所有字符以外的字符
[root@localhost testdir]# ls
fa fb fc fd ff fs
[root@localhost testdir]# ls -d f[abhgc]
fa fb fc
[root@localhost testdir]# ls -d f[^abhgc]
fd ff fs
预定义的字符类: :#man 7 glob
[:digit:]:任意数字,相当于0-9
[root@localhost ~]# ls
aaa f1 f3 f5 fa fb fc fd fe ff testdir
anaconda-ks.cfg f2 f4 f6 fA fB fC fD fE fF
[root@localhost ~]# ls f[[:digit:]]
f1 f2 f3 f4 f5 f6
[:lower:]:任意小写字母
[root@localhost ~]# ls
aaa f1 f3 f5 fa fb fc fd fe ff testdir
anaconda-ks.cfg f2 f4 f6 fA fB fC fD fE fF
[root@localhost ~]# ls f[[:digit:]]
f1 f2 f3 f4 f5 f6
[root@localhost ~]# ls f[[:lower:]]
fa fb fc fd fe ff
[:upper:]: 任意大写字母
[root@localhost ~]# ls
aaa f1 f3 f5 fa fb fc fd fe ff testdir
anaconda-ks.cfg f2 f4 f6 fA fB fC fD fE fF
[root@localhost ~]# ls f[[:lower:]]
fa fb fc fd fe ff
[root@localhost ~]# ls f[[:upper:]]
fA fB fC fD fE fF
[:alpha:]: 任意大小写字母
[root@localhost ~]# ls
aaa f1 f3 f5 fa fb fc fd fe ff testdir
anaconda-ks.cfg f2 f4 f6 fA fB fC fD fE fF
[root@localhost ~]# ls f[[:lower:]]
fa fb fc fd fe ff
[root@localhost ~]# ls f[[:upper:]]
fA fB fC fD fE fF
[root@localhost ~]# ls f[[:alpha:]]
fa fA fb fB fc fC fd fD fe fE ff fF
[:alnum:]:任意数字或字母
[root@localhost ~]# ls
aaa f1 f3 f5 fa fb fc fd fe ff testdir
anaconda-ks.cfg f2 f4 f6 fA fB fC fD fE fF
[root@localhost ~]# ls f[[:lower:]]
fa fb fc fd fe ff
[root@localhost ~]# ls f[[:upper:]]
fA fB fC fD fE fF
[root@localhost ~]# ls f[[:alpha:]]
fa fA fb fB fc fC fd fD fe fE ff fF
[root@localhost ~]# ls f[[:alnum:]]
f1 f2 f3 f4 f5 f6 fa fA fb fB fc fC fd fD fe fE ff fF
[:space:]:空格
[:punct:]:标点符号
查看文件状态
stat:
文件:metadata, data
三个时间戳:
access time :访问时间,atime ,读取文件内容
modify time: 修改时间, mtime ,改变文件内容(数据)
change time: 改变时间, ctime ,元数据发生改变
一般在atime和mtime发生改变是,ctime都会跟着改变
在atime时间大于一天时或者atime时间小于mtime时,atime都会更新
显示当前shell进程所有的可用的命令别名
[root@localhost ~]# alias
alias cp='cp -i'
alias egrep='egrep --color=auto'
alias fgrep='fgrep --color=auto'
alias grep='grep --color=auto'
alias l.='ls -d .* --color=auto'
alias ll='ls -l --color=auto'
alias ls='ls --color=auto'
alias mv='mv -i'
alias rm='rm -i'
alias which='alias | /usr/bin/which --tty-only --read-alias --show-dot --show-tilde'
定义别名NAME ,其相当于执行命令VALUE;
[root@localhost ~]# alias ls
alias ls='ls --color=auto'
[root@localhost ~]# ls
aaa f1 f3 f5 fa fb fc fd fe ff testdir
anaconda-ks.cfg f2 f4 f6 fA fB fC fD fE fF
[root@localhost ~]# ls --color=auto
aaa f1 f3 f5 fa fb fc fd fe ff testdir
anaconda-ks.cfg f2 f4 f6 fA fB fC fD fE fF
定义别名格式: alias NAME='VALUE'
在命令行中定义的别名,仅对当前shell 进程有效
如果想永久有效,要定义在配置文件中
仅对当前用户:~/.bashrc
对所有用户有效:/etc/bashrc
编辑配置给出的新配置不会立即生效;
bash 进程重新读取配置文件: source /path/to/config_file
. /path/to/config_file
撤消别名:unalias
unalias [-a] name [name ...]
如果别名同原命令同名,如果要执行原命令,可使用
“\COMMAND”
’COMMAND’
/PATH/COMMAND
或者\COMMAND