当前位置:网站首页>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 .
边栏推荐
- 【UE5】AI随机漫游蓝图两种实现方法(角色蓝图、行为树)
- 逆变器simulink模型——处理器在环测试(PIL)
- Fragmenttabhost implements the interface of housing loan calculator
- Alibaba / popular JSON parsing open source project fastjson2
- 每天睡觉前30分钟阅读_day4_Files
- 2837xd 代码生成——StateFlow(4)
- PI control of grid connected inverter (grid connected mode)
- 2837xd代码生成模块学习(3)——IIC、eCAN、SCI、Watchdog、eCAP模块
- Matlab生成dsp程序——官方例程学习(6)
- Cmake command - Official Document
猜你喜欢

逆变器simulink模型——处理器在环测试(PIL)

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

ZK configuration center -- configuration and use of config Toolkit

QT qlabel style settings

三相逆变器离网控制——PR控制

Image recognition - Data Cleaning

Activity的创建和跳转

Kinect DK obtains color RGB images in cv:: mat format (used in openpose)

MySQL transaction

Skywalking理论与实践
随机推荐
2837xd 代码生成——总结篇
Navicat remote connection MySQL reports an error 1045 - access denied for user 'root' @ '222.173.220.236' (using password: yes)
Fragmenttabhost implements the interface of housing loan calculator
[Yu Yue education] University Physics (Electromagnetics) reference materials of Taizhou College of science and technology, Nanjing University of Technology
Memories of a chat
tinyxml2 读取和修改文件
Typora installation package sharing
Typora安装包分享
Image recognition - data augmentation
2837xd 代碼生成——StateFlow(4)
FragmentTabHost实现房贷计算器界面
QT信号槽总结-connect函数错误用法
MySQL index
2837xd 代码生成——补充(3)
C language strawberry
XA Transaction SQL Statements
2837xd code generation - Summary
Idempotent design of Internet API interface
Failed to configure a DataSource: ‘url‘ attribute is not specified and no embedd
Matlab生成dsp程序——官方例程学习(6)