linux数据流重定向
2015-08-17 13:21
281 查看
数据流重定向
1)标准输入(stdin):代码为0,使用<或者<<2)标准输出(stdout):代码为1,使用>或者>>
3)标准错误输出(stderr):代码为2,使用2>或者2>>
1> 覆盖(先删除之前的内容,后写入)
1>>累加(在原先内容后面跟加)
2> 覆盖(先删除之前的内容,后写入)
2>>累加(在原先内容后面跟加)
特殊用法,将stdout,stderr分别存到不同的文件中
eg:
find/home -name .bashrc > list_right
2>list_error
输入到同一个文件
错误写法:find/home -name .bashrc > list 2>list
正确写法:(也称为“镜像”)
find/home -name .bashrc > list 2>&1
或者
find/home -name .bashrc &>list
垃圾黑洞
将错误信息忽略掉,不显示或者存储黑洞设备:
/dev/null
find/home -name .bashrc > list 2>/dev/null
相关文章推荐
- linux 生名变量类型 declare
- linux 中各引号的作用
- linux下的环境文件设置说明
- linux目录结构
- Linux Socket Errno错误代码列表以及常见错误
- centos下载
- linux( 二)
- Linux启动新进程的几种方法及比较
- Linux下vim命令
- Linux进程间通信——使用命名管道
- linux(一)
- linux系统的开机流程
- linux系统的开机流程
- Linux下把文件夹复制到所有同名文件夹的脚本
- Linux进程间通信——使用匿名管道
- centos 7下拨号上网 及 firefox安装flash后遇到的问题
- linux下的文件结构
- linux下IDE环境:eclipse
- 【Linux学习】epoll详解
- linux 下如何给火狐安装flash插件(常用命令cd cp tar 实践)