1.重定向(>)
重定向会把目标文件全清空 ,要想直接清空某个文件直接输入: > test
root@chances126 gao]#
[root@chances126 gao]# seq 10 > test
[root@chances126 gao]# ll
总用量 4
-rw-r--r-- 1 root root 21 1月 24 09:51 test
You have new mail in /var/spool/mail/root
[root@chances126 gao]# cat test
1
2
3
4
5
6
7
8
9
10
[root@chances126 gao]#
清屏: Ctrl+L 或者 clear
2.追加重定向(>>)
追加重定向会在目标文件的尾部加上命令的执行结果
[root@chances126 gao]# seq 2 >test
You have mail in /var/spool/mail/root
[root@chances126 gao]# cat test
1
2
[root@chances126 gao]# seq 3 >> test
[root@chances126 gao]# cat test
1
2
1
2
3
3.管道(|)
过滤
exp:经常使用的前10个命令
[root@chances126 gao]# cat history.txt | awk '{print $2}'|sort|uniq -c|sort -rn|head
315 cd
276 ll
81 du
69 ls
61 cat
32 rm
23 echo
19 ifconfig
17 ./catalina.sh
12 pwd
[root@chances126 gao]#
其实这些内容自己也经常用,只不过是这些知识都是自己零碎着使用掌握的,并没有系统的学习。想看些自己遗漏的地方。