1.cat是一个简单的通用的命令,它可以来显示文本内容,创建文件,还可以显示控制字符
[root@localhost shell]# cat test1.txt test2.txt test3.txt  //连续查看test1-3的内容
test1
test2
test3

2.管道|

[root@localhost ~]# who //who查看信息
root     tty1         2013-03-29 11:19
root     pts/0        2013-03-29 14:16 (192.168.22.33)


[root@localhost ~]# who|awk '{print $1 "\t" $2 }'//显示 who的前两列\t是跳格显示
root    tty1
root    pts/0

[root@localhost ~]# df -h //查看磁盘大小
Filesystem            Size  Used Avail Use% Mounted on
/dev/hda2             9.7G  4.4G  4.9G  48% /
/dev/hda1              99M   20M   75M  21% /boot
tmpfs                 227M     0  227M   0% /dev/shm
none                  227M  104K  227M   1% /var/lib/xenstored

[root@localhost ~]# df -h|awk '{print $1"\t" $3}'|grep -v "Used"| //查看空间大小利用管道和awk打印第一列和第二列中间利用\t跳格,再次利用管道和grep Used字段。
/dev/hda2       4.4G
/dev/hda1       20M
tmpfs   0
none    104K

3.tee命令当执行脚本或者命令时候想把结果保存起来就要用到tee命令-a参数在末尾添加
[root@localhost shell]# ls -l|tee ls.txt //利用tee创建一个ls.txt文件
total 12
-rw-r--r-- 1 root root 0 Mar 29 14:33 ls.txt
-rw-r--r-- 1 root root 6 Mar 29 14:13 test1.txt
-rw-r--r-- 1 root root 6 Mar 29 14:14 test2.txt
-rw-r--r-- 1 root root 6 Mar 29 14:14 test3.txt

[root@localhost shell]# cat ls.txt //查看ls.txt文件如下
total 12
-rw-r--r-- 1 root root 0 Mar 29 14:33 ls.txt
-rw-r--r-- 1 root root 6 Mar 29 14:13 test1.txt
-rw-r--r-- 1 root root 6 Mar 29 14:14 test2.txt
-rw-r--r-- 1 root root 6 Mar 29 14:14 test3.txt

4. 点.可以匹配任何单字符
[root@localhost ~]# ls -l|grep ...x..x..x //匹配有执行权限的文件
drwxr-xr-x 2 root root  4096 May 18  2012 Desktop
drwxr-xr-x 2 root root  4096 Mar 29 14:33 shell
drwxr-xr-x 3 root root  4096 Mar 28 10:52 tasks

5.匹配行首^ 以匹配字符串和字符序列
[root@localhost ~]# ll|grep ^d //匹配首行为d目录的文件
drwxr-xr-x 2 root root  4096 May 18  2012 Desktop
drwxr-xr-x 2 root root  4096 Mar 29 14:33 shell
drwxr-xr-x 3 root root  4096 Mar 28 10:52 tasks