您的位置:首页 > 运维架构 > Linux

Linux stdin stdout stderr

2014-01-13 14:18 381 查看
stdin: 0

stdout: 1 Shell的默认值。

stderr: 2

常见于:

ls -l 1 > /dev/null 2>&1
将stdout重定向到“虚空”, stderr追加给stdout

“虚空”的另一个用法

[oracle@odilab ~]$ ls -ltrh 1.txt
-rw-r--r-- 1 oracle oinstall 11M Jan 12 22:52 1.txt
[oracle@odilab ~]$ cat /dev/null > 1.txt
[oracle@odilab ~]$ ls -ltrh 1.txt
-rw-r--r-- 1 oracle oinstall 0 Jan 13 01:22 1.txt
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: