每天一个Linux命令:tee

2017-03-19  本文已影响55人  BlackChen

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)
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
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;
}

上一篇 下一篇

猜你喜欢

热点阅读