首页 > 代码库 > 重定向

重定向

[root@localhost ~]# cat /etc/passwd > 1.txt    # 重定向,会覆盖 1.txt 文件的内容[root@localhost ~]# cat /etc/passwd >> 1.txt   # 追加重定向[root@localhost ~]# cat /etc/passss 2> 1.txt   # 错误重定向[root@localhost ~]# cat /etc/passss 2>> 1.txt  # 错误追加重定向[root@localhost ~]# wc -l < /etc/passwd        # 反向重定向,即把一个文件的内容丢给前面的命令执行

 

 

 

 

 

 

    

重定向