Linux tee command

Source: Internet
Author: User

Linux tee command

Name: tee

Location:/usr/bin/tee

Permission: All Users

Purpose: bidirectional redirection: data streams are sent to files and screens at the same time. stdout is the output to the screen, which allows the next command to continue processing.

Usage: tee [OPTION]... [FILE]...

Option:

-A, -- append to the given FILEs, do not overwrite

Append

Bidirectional redirection: after the last. list file is written, it can be output to the screen.

last |tee last.listcwjy1202 pts/0        :0               Sat Jan 10 22:14   still logged in   reboot   system boot  3.2.0-24-generic Sat Jan 10 21:45 - 23:02  (01:16)    cwjy1202 pts/0        :0.0             Sat Jan 10 19:24 - down   (00:00)    reboot   system boot  3.2.0-24-generic Sat Jan 10 14:17 - 19:24  (05:07)    reboot   system boot  3.2.0-24-generic Fri Jan  9 20:50 - 22:50  (01:59)    cwjy1202 pts/0        :0               Thu Jan  8 22:08 - 23:16  (01:08)    reboot   system boot  3.2.0-24-generic Thu Jan  8 21:45 - 23:17  (01:31)    cwjy1202 pts/2        :0               Wed Jan  7 23:22 - 00:27  (01:05)    cwjy1202 pts/0        :0               Wed Jan  7 23:04 - 00:27  (01:23)    reboot   system boot  3.2.0-24-generic Wed Jan  7 23:03 - 00:27  (01:23)    cwjy1202 pts/2        :0               Tue Jan  6 23:10 - 23:46  (00:36)    cwjy1202 pts/0        :0               Tue Jan  6 22:32 - 23:46  (01:13)    reboot   system boot  3.2.0-24-generic Tue Jan  6 19:32 - 23:46  (04:13)    cwjy1202 pts/0        :0               Tue Jan  6 00:24 - 00:46  (00:21)    reboot   system boot  3.2.0-24-generic Mon Jan  5 20:59 - 00:46  (03:47)    cwjy1202 pts/0        :0               Sat Jan  3 20:33 - 00:39  (04:06)    cwjy1202 pts/0        :0               Sat Jan  3 19:23 - 19:24  (00:00)    reboot   system boot  3.2.0-24-generic Sat Jan  3 19:12 - 00:41  (05:28)    cwjy1202 pts/2        :0               Sat Jan  3 14:58 - 17:04  (02:05)    cwjy1202 pts/1        :0               Sat Jan  3 14:57 - 17:04  (02:07)    reboot   system boot  3.2.0-24-generic Sat Jan  3 14:54 - 17:05  (02:10)    wtmp begins Fri Jan  2 17:17:32 2015
Note: The preceding tee command and No option added-In this way, the default file will be overwritten.

In the following example, the last information is written to the last. list file and can be processed by the sed command.

$ last |tee  -a last.list| sed -n '1p'cwjy1202 pts/0        :0               Sat Jan 10 22:14   still logged in 


Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.