每天一个Linux命令:tee

tee

前几天电脑坏了。。。尴尬

tee - read from standard input and write to standard output and files
从标准输入读取信息,并且输出到标准输出和文件

cc@MyLinux:~/test$ who |tee a.file
cc       tty1         2017-03-19 07:01
cc       pts/0        2017-03-19 07:02 (192.168.254.1)
cc@MyLinux:~/test$ cat a.file
cc       tty1         2017-03-19 07:01
cc       pts/0        2017-03-19 07:02 (192.168.254.1)
  • -a 追加,不清空原来文件中的信息
cc@MyLinux:~/test$ pwd |tee -a a.file
/home/cc/test
cc@MyLinux:~/test$ cat a.file
cc       tty1         2017-03-19 07:01
cc       pts/0        2017-03-19 07:02 (192.168.254.1)
/home/cc/test
cc@MyLinux:~/test$ who |tee b.file
  • 用tee生成文件
cc@MyLinux:~/test$ tee test.c
#include <stdio.h>
#include <stdio.h>


int main()
int main()
{
{
        printf("hello tee\n"); 
    printf("hello tee⛮");
    return 0;
    return 0;
}
}
^C
cc@MyLinux:~/test$ 

cc@MyLinux:~/test$ cat test.c 
#include <stdio.h>

int main()
{
    printf("hello tee⛮");
    return 0;
}

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
【社区内容提示】社区部分内容疑似由AI辅助生成,浏览时请结合常识与多方信息审慎甄别。
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

相关阅读更多精彩内容

  • Spring Cloud为开发人员提供了快速构建分布式系统中一些常见模式的工具(例如配置管理,服务发现,断路器,智...
    卡卡罗2017阅读 136,792评论 19 139
  • Linux Commands - Overview and Examples The command line i...
    RiboseYim阅读 1,824评论 0 32
  • linux资料总章2.1 1.0写的不好抱歉 但是2.0已经改了很多 但是错误还是无法避免 以后资料会慢慢更新 大...
    数据革命阅读 13,498评论 2 33
  • 基础知识点 协议采用HLS(HTTP Live Streaming),是一个由苹果公司提出的基于HTTP的流媒体网...
    松哥888阅读 1,075评论 0 13
  • 在希望中成长 小溪奔向大海,向日暌向着阳光,你像花儿一样, 在花园里成长,小小年纪,有大大志向,多希望有一天在蓝天...
    damingdingding阅读 232评论 0 0

友情链接更多精彩内容