linux系统中,tee命令的使用

需求描述:

  今天在看nginx内容的过程,遇到了tee这个命令,所以查询了下,在这里记录下使用方法.

操作过程:

1.执行以下的命令

[root@testvm ~]# uname -n | tee hostInfo
testvm
[root@testvm ~]# cat hostInfo 
testvm

备注:通过以上的执行可以知道,tee命令是从标准输入读取内容,然后将读取到的内容写到标准输出和指定的文件.所以,在屏幕中出现了uname -n的结果,文件中也存有该信息.

 2.tee命令的使用方法

复制代码
Usage: tee [OPTION]... [FILE]...
Copy standard input to each FILE, and also to standard output.

  -a, --append              append to the given FILEs, do not overwrite
  -i, --ignore-interrupts   ignore interrupt signals
      --help     display this help and exit
      --version  output version information and exit

If a FILE is -, copy again to standard output.

Report tee bugs to bug-coreutils@gnu.org
GNU coreutils home page: <http://www.gnu.org/software/coreutils/>
General help using GNU software: <http://www.gnu.org/gethelp/>
For complete documentation, run: info coreutils 'tee invocation'
复制代码

 

小结:

  tee命令的作用将输入的内容写入到屏幕和文件,输入屏幕的作用是查看,前面命令的执行结果是否是自己想要的.

 

文档创建时间:2018年4月24日10:38:01

posted @   Zhai_David  阅读(3195)  评论(0编辑  收藏  举报
编辑推荐:
· SQL Server 2025 AI相关能力初探
· Linux系列:如何用 C#调用 C方法造成内存泄露
· AI与.NET技术实操系列(二):开始使用ML.NET
· 记一次.NET内存居高不下排查解决与启示
· 探究高空视频全景AR技术的实现原理
阅读排行:
· 阿里最新开源QwQ-32B,效果媲美deepseek-r1满血版,部署成本又又又降低了!
· AI编程工具终极对决:字节Trae VS Cursor,谁才是开发者新宠?
· 开源Multi-agent AI智能体框架aevatar.ai,欢迎大家贡献代码
· Manus重磅发布:全球首款通用AI代理技术深度解析与实战指南
· 被坑几百块钱后,我竟然真的恢复了删除的微信聊天记录!
点击右上角即可分享
微信分享提示