什么是"/dev/null"?在shell命令末尾的意思 [英] What does "/dev/null" mean at the end of shell commands

查看:94
本文介绍了什么是"/dev/null"?在shell命令末尾的意思的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

以下命令之间有什么区别?

What is the difference between the following commands?

ssh myhostname "command1; command2;...commandn;" 2>/dev/null
ssh myhostname "command1; command2;...commandn;" 

  1. 2>是什么意思?

/dev/null是什么意思?我在某处读取到命令结果将写入文件/dev/null而不是控制台!这样对吗?对我来说,文件名是null

what does /dev/null mean? I read somewhere that result of command will be write to file /dev/null instead of console! Is it right? It seems strange for me that the name of file be null!

推荐答案

2>表示将重定向标准错误"重定向到给定文件.

2> means "redirect standard-error" to the given file.

/dev/null是空文件.写入其中的所有内容都将被丢弃.

/dev/null is the null file. Anything written to it is discarded.

它们的共同含义是丢弃任何错误消息".

Together they mean "throw away any error messages".

这篇关于什么是"/dev/null"?在shell命令末尾的意思的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆