Linuxtee命令怎么使用-成都快上网建站

Linuxtee命令怎么使用

今天小编给大家分享一下Linux tee命令怎么使用的相关知识点,内容详细,逻辑清晰,相信大部分人都还太了解这方面的知识,所以分享这篇文章给大家参考一下,希望大家阅读完这篇文章后有所收获,下面我们一起来了解一下吧。

为科尔沁等地区用户提供了全套网页设计制作服务,及科尔沁网站建设行业解决方案。主营业务为网站建设、成都网站制作、科尔沁网站设计,以传统方式定制建设网站,并提供域名空间备案等一条龙服务,秉承以专业、用心的态度为用户提供真诚的服务。我们深信只要达到每一位用户的要求,就会得到认可,从而选择与我们长期合作。这样,我们也可以走得更远!

Linux tee命令的功能是从标准输入读取,再写入标准输出和文件,其使用语法是“tee [OPTION]... [FILE]...”,其中参数“-a --append”表示追加到文件,参数“-i --ignore-interrupts”表示忽略中断信号,参数“-p”表示诊断写入非管道的错误等。

linux 命令:tee 详解

tee 的功能是从标准输入读取,再写入标准输出和文件。

用法:tee [OPTION]... [FILE]...

-a, --append                        追加到文件

-i, --ignore-interrupts           忽略中断信号

-p                                         诊断写入非管道的错误

--output-error[=MODE]        设置输出错误的方式,MODE 的选项在下边

--help                                   帮助文档

--version                              版本信息

MODE:

warn                   写入遇到错误时诊断

warn-nopipe       写入非管道遇到错误时诊断

exit                     写入遇到错误时退出

exit-nopipe         写入非管道遇到错误时退出

如果没有指定 --output-error,tee 会在写入管道发生错误时立即退出,写入非管道时诊断。

使用示例:

默认功能和追加功能:

[root@server dir]# echo 'This is a sentence.' | tee output
This is a sentence.

[root@server dir]# cat output
This is a sentence.

[root@server dir]# echo 'This is another sentence.' | tee -a output
This is another sentence.

[root@server dir]# cat output
This is a sentence.
This is another sentence.

[root@server dir]# echo 'This is a unique sentence.' | tee output
This is a unique sentence.

[root@server dir]# cat output
This is a unique sentence.

同时写入两个文件:

[root@server dir]# tee a b
they have the same content
they have the same content
^C
[root@server dir]# cat a
they have the same content
[root@server dir]# cat b
they have the same content

以上就是“Linux tee命令怎么使用”这篇文章的所有内容,感谢各位的阅读!相信大家阅读完这篇文章都有很大的收获,小编每天都会为大家更新不同的知识,如果还想学习更多的知识,请关注创新互联行业资讯频道。


新闻标题:Linuxtee命令怎么使用
当前URL:http://kswjz.com/article/gdcgpg.html
扫二维码与项目经理沟通

我们在微信上24小时期待你的声音

解答本文疑问/技术咨询/运营咨询/技术建议/互联网交流