当前位置:网站首页>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 .
边栏推荐
- kinect dk 获取CV::Mat格式的彩色RGB图像(openpose中使用)
- 2837xd code generation module learning (1) -- GPIO module
- 图像识别-数据增广
- QT信号槽总结-connect函数错误用法
- Record the interesting process of using Xray for the first time
- Alibaba cloud SMS service
- Alibaba cloud ack introduction
- 每天睡觉前30分钟阅读_day3_Files
- Bugkuctf-web24 (problem solving ideas and steps)
- Read Day6 30 minutes before going to bed every day_ Day6_ Date_ Calendar_ LocalDate_ TimeStamp_ LocalTime
猜你喜欢
Kinect DK obtains color RGB images in cv:: mat format (used in openpose)
Summary of demand R & D process nodes and key outputs
MySQL transaction
图像识别-数据清洗
ICLR 2022: how does AI recognize "things I haven't seen"?
TD conducts functional simulation with Modelsim
Introduction et prévention des essais de pénétration
Matlab生成dsp程序——官方例程学习(6)
In SQL injection, why must the ID of union joint query be equal to 0
每天睡觉前30分钟阅读_day4_Files
随机推荐
MySQL index
2837xd code generation - stateflow (3)
kinect dk 获取CV::Mat格式的彩色RGB图像(openpose中使用)
每天睡觉前30分钟阅读_day3_Files
TD联合Modelsim进行功能仿真
Binary and decimal system of C language
TD conducts functional simulation with Modelsim
Alibaba cloud SLS log service
图像识别-数据增广
Typora安装包分享
Idempotent design of Internet API interface
Skywalking理论与实践
C language: making barrels
【UE5】蓝图制作简单地雷教程
2837xd代码生成模块学习(4)——idle_task、Simulink Coder
大学生四六级作文模板(自创版,成功跨过六级)
PI control of three-phase grid connected inverter - off grid mode
Mixed development of uni app -- Taking wechat applet as an example
渗透测试的介绍和防范
Junit5 supports suite methods