linux redirect pipeline

Redirect

Output redirection integrated case
output is redirected into normal output and error output
Normal output
1> is equivalent to>
1 >> >> equivalent to the
error output
2 >>
2>
Case 1, output redirection

date 1> date.txt
date >> date.txt

Case II: error output redirection

 ls /home/    2>    list.txt     //错误示范
ls  /aaaaaaaaa 2>  list.txt   //正确示范
cat list.txt

pipeline

About
Pipe command can combine multiple commands, one-time completion of complex processing tasks
cases

cat   /etc/passwd  |  tail -3     //查看后三行etc下的passwd文件
ps aux    |   grep 'sshd'   //只看sshd

pipe tee
pipe tee, i.e., processing to another program. And keep a copy of
the parameter passed xargs

cat files.txt | xargs rm -rvf     //通过xargs 连接rm命令
Published 10 original articles · won praise 81 · views 10000 +

Guess you like

Origin blog.csdn.net/weixin_45508789/article/details/104682912