'>' 输出到文件中。文件不存在会创建。文件已存在,内容会被覆盖。文件时间会更新。第一次输入'>test',第二次输入'>testagain',发现内容[root@localhost~]#ll总用量8-rw-------.1rootroot15558月 2015:30anaconda-ks.cfg-rw-r--r-- 1rootroot 72月 118:03echo.log[root@localhost~]#catecho.log>test[root@localhost~]#echo'>testagain'>echo.log[root@localhost~]#catecho.log>testagain[root@localhost~]#ll总用量8-rw-------.1rootroot15558月 2015:30anaconda-ks.cfg-rw-r--r-- 1rootroot 132月 118:04echo.log最后输出只有:'>testagain' 删除echo.log,测试'>>''>>'输出到文件中。文件不存在会创建。文件已存在,内容会继续追加在后面。文件时间会更新。[root@localhost~]#rmecho.logrm:是否删除普通文件"echo.log"?y[root@localhost~]#ll总用量4-rw-------.1rootroot15558月 2015:30anaconda-ks.cfg[root@localhost~]#echo'>test'>>echo.log[root@localhost~]#ll总用量8-rw-------.1rootroot15558月 2015:30anaconda-ks.cfg-rw-r--r-- 1rootroot 72月 118:11echo.log[root@localhost~]#catecho.log>test[root@localhost~]#echo'>testagain'>>echo.log[root@localhost~]#ll总用量8-rw-------.1rootroot15558月 2015:30anaconda-ks.cfg-rw-r--r-- 1rootroot 202月 118:12echo.log[root@localhost~]#catecho.log>test>testagain最后输出,文本中有两行。>test>testagain辅助记忆:这两个都是重定向,>>比较长,只有继续跟在后面附加,文本才会比较长。>比较短,理解成替换文本,才不会那么长。更详细更多的Linux命令可查看下Linux命令的介绍,查找方式如下:
阅读全文 >