当前位置:网站首页>Tee command usage example
Tee command usage example
2022-07-02 09:57:00 【Teacher Liu Trent】
tee command Used to read standard input data , Output content to screen , At the same time save it as a file , And can be saved to multiple files . |
How to use tee
tee The most basic usage is to display the output and save the content to a file . The following example uses free command Display system memory usage information , And use tee The command outputs information to the screen , And save to file mem.txt in .
[[email protected] ~]# free -h | tee mem.txt
total used free shared buff/cache available
Mem: 1.8G 164M 1.2G 9.6M 387M 1.5G
Swap: 2.0G 0B 2.0G
- 1.
- 2.
- 3.
- 4.
You can have a look mem.txt file , You can see that the output has been saved to mem.txt Inside the .

Write to multiple files
tee Multiple files can be written , Separate each file with a space .
[[email protected] ~]# free -h | tee mem1.txt mem2.txt mem3.txt
total used free shared buff/cache available
Mem: 1.8G 165M 1.2G 9.6M 389M 1.5G
Swap: 2.0G 0B 2.0G
- 1.
- 2.
- 3.
- 4.

Add content at the bottom of the existing file
The following example uses options -a Add content at the bottom of the file , Don't cover the original content .
[[email protected] ~]# free -h | tee -a mem.txt
total used free shared buff/cache available
Mem: 1.8G 165M 1.2G 9.6M 389M 1.5G
Swap: 2.0G 0B 2.0G
- 1.
- 2.
- 3.
- 4.
You can see , stay mem.txt New content is added at the bottom of the file .

If you don't want to output on the screen , have access to > Standard output symbol , Redirect to /dev/null in :
[[email protected] ~]# free -h | tee -a mem.txt > /dev/null
- 1.
summary
tee Command is used to read standard input data , Output content to screen , At the same time save it as a file , And can be saved to multiple files .
边栏推荐
- 2837xd Code Generation - Supplement (1)
- [Yu Yue education] University Physics (Electromagnetics) reference materials of Taizhou College of science and technology, Nanjing University of Technology
- XA Transaction SQL Statements
- Alibaba cloud SMS service
- Attack and defense world web advanced area unserialize3
- C语言之到底是不是太胖了
- 三相并网逆变器PI控制——离网模式
- [ue5] animation redirection: how to import magic tower characters into the game
- Navicat 远程连接Mysql报错1045 - Access denied for user ‘root‘@‘222.173.220.236‘ (using password: YES)
- 2837xd 代码生成——StateFlow(3)
猜你喜欢

Skywalking theory and Practice

图像识别-数据增广

2837xd代码生成模块学习(1)——GPIO模块

Summary of demand R & D process nodes and key outputs

kinect dk 获取CV::Mat格式的彩色RGB图像(openpose中使用)

Idempotent design of Internet API interface

Junit5 支持suite的方法

High level application of SQL statements in MySQL database (II)

滲透測試的介紹和防範

In SQL injection, why must the ID of union joint query be equal to 0
随机推荐
Required request body is missing: (cross domain problem)
Introduction and prevention of penetration test
图像识别-数据标注
Read 30 minutes before going to bed every day_ day4_ Files
FragmentTabHost实现房贷计算器界面
个人经历&&博客现状
Matlab代码生成之SIL/PIL测试
2837xd 代码生成——StateFlow(4)
Large neural networks may be beginning to realize: the chief scientist of openai leads to controversy, and everyone quarrels
渗透测试的介绍和防范
2837xd code generation module learning (3) -- IIC, ECAN, SCI, watchdog, ECAP modules
Image recognition - data annotation
Record personal understanding and experience of game console configuration
Tinyxml2 reading and modifying files
2837xd 代码生成——补充(1)
Cmake command - Official Document
[Yu Yue education] University Physics (Electromagnetics) reference materials of Taizhou College of science and technology, Nanjing University of Technology
C语言之做木桶
Binary and decimal system of C language
记录一下初次使用Xray的有趣过程