丢弃的输出(Discard the output)(过滤的输出)

本文介绍了如何使用重定向命令来控制命令输出及错误信息流向特殊文件 /dev/null 的方法,包括如何仅丢弃输出、如何同时丢弃输出和错误信息等技巧。

Sometimes you will need to execute a command, but you don't want the output displayed to the screen. In such cases you can discard the output by redirecting it to the file /dev/null:

$ command > /dev/null

Here command is the name of the command you want to execute. The file /dev/null is a special file that automatically discards all its input.

To discard both output of a command and its error output, use standard redirection to redirect STDERR to STDOUT:

$ command > /dev/null 2>&1

Here 2 represents STDERR and 1 represents STDOUT. You can display a message on to STDERR by redirecting STDIN into STDERR as follows:

$ echo message 1>&2

Redirection Commands:

Following is the complete list of commands which you can use for redirection:

CommandDescription
pgm > fileOutput of pgm is redirected to file
pgm < fileProgram pgm reads its input from file.
pgm >> fileOutput of pgm is appended to file.
n > fileOutput from stream with descriptor n redirected to file.
n >> fileOutput from stream with descriptor n appended to file.
n >& mMerge output from stream n with stream m.
n <& mMerge input from stream n with stream m.
<< tagStandard input comes from here through next tag at start of line.
|Takes output from one program, or process, and sends it to another.



                                                                                                                        Name:Xr

                                                                                                                        Date:2014-06-01 17:01


转载于:https://my.oschina.net/Xiao629/blog/271489

解释下这些选项的功能:Options: -call_tree Create a context-sensitive call tree -compact_labels Show minimal headers -divide_by Ratio to divide all samples before visualization -drop_negative Ignore negative differences -edgefraction Hide edges below <f>*total -focus Restricts to samples going through a node matching regexp -hide Skips nodes matching regexp -ignore Skips paths going through any nodes matching regexp -intel_syntax Show assembly in Intel syntax -mean Average sample value over first value (count) -nodecount Max number of nodes to show -nodefraction Hide nodes below <f>*total -noinlines Ignore inlines. -normalize Scales profile based on the base profile. -output Output filename for file-based outputs -prune_from Drops any functions below the matched frame. -relative_percentages Show percentages relative to focused subgraph -sample_index Sample value to report (0-based index or name) -show Only show nodes matching regexp -show_from Drops functions above the highest matched frame. -showcolumns Show column numbers at the source code line level. -source_path Search path for source files -tagfocus Restricts to samples with tags in range or matched by regexp -taghide Skip tags matching this regexp -tagignore Discard samples with tags in range or matched by regexp -tagleaf Adds pseudo stack frames for labels key/value pairs at the callstack leaf. -tagroot Adds pseudo stack frames for labels key/value pairs at the callstack root. -tagshow Only consider tags matching this regexp -trim Honor nodefraction/edgefraction/nodecount defaults -trim_path Path to trim from source paths before search -unit Measurement units to display
最新发布
09-06
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值