标准输入设备:keyboard ,mouse 标准输出设备:printer,monitor

标准输入输出与管道_管道

  STDIN  标准输入,代码为0,使用<或&lt;&lt;

  STDOUT标准输出,代码为1,使用>或&gt;&gt;

  STDERR标准错误输出,代码为2,使用2&gt;或2&gt;&gt;

              command &gt; file        将命令的执行结果覆盖到file文件中

              command &gt;&gt; file      将命令的执行结果追加到file文件中

              command < file        将文件内的内容传递给命令执行

              command &lt;&lt; file      将文件内的内容传递给命令执行

              command 2> file       将命令执行的错误信息覆盖到文件file

              command 2&gt;&gt; file    将命令执行的错误信息追加到文件file

           2&gt;&1错误运行时,将错误信息重定向到正确的信息中,正确运行时写入正确信息

           find /etc/ -name passwd  &gt;find.txt       查找结果覆盖到文件中

           find /etc/ -name passwd  2&gt; /dev/null   错误信息丢弃到数据"黑洞"中

           find /etc/ -name passwd  &gt; find.out  2&gt;find.err  正确信息输

                             出到 find.out   错误信息输出到 find.err

             find /etc -name  passwd &&gt; findall 输出所有信息不管对错

            find /etc -name  passwd 2&gt;& 1 |less 输出错误信息到正确信息

管道 |   作用:将一个命令的输出当做另一个命令的输入

                ls -c | tr 'a-z' 'A-Z'

less    ls  -l  /etc/ |less

mail    echo "test mail" |  mail -s "test"  user@example.com  

ipr    echo "test print" |ipr