linux--touch,xargs,重定向

创建文件:

    touch test{0..2}.txt------------创建连续多个文件

 

重定向:

    >输出

      >覆盖,>>追加,2>>错误重定向输出

        cat>>test.txt  输入文本用ctrl+d结束

        echo '   '>>test.txt

        >test.txt       清空test.txt

        listlist 2>error.log 将错误放到error.log

        echo ''>a.txt 2>&1   

xargs:

   管道是实现“将前面的标准输出作为后面的标准输入”
   xargs是实现“将标准输入(字符串)转化为命令的参数”

    xargs 可以读入 stdin 的资料,并且以空白字元或断行字元作为分辨,将 stdin 的资料分隔成为 arguments 。

    find . -type f -name 'test*'|xargs rm -f

    find . -type f -name 'test*'|xargs cat

    

    

 

posted @ 2017-05-19 18:35  wangxingg  阅读(704)  评论(0编辑  收藏  举报