Winter Bootcamp in ML and IoT in Jaipur
 Course content (For Bootcamp & Winter Training):- Machine Learning (ML) || Internet of Things (IoT) || Register for winter bootcamp
0 like 0 dislike
in Tutorial & Interview questions by (3.1k points)

1 Answer

0 like 0 dislike
by (3.1k points)
 
Best answer

Options                        Description

-a, --append Append to the given FILEs. Do not overwrite.

-i, --ignore-interrupts Ignore interrupt signals.

--help Display a help message, and exit.

--version Display version information, and exit.

tee - read from standard input and write to standard output and files.


The tee command is named after the T-splitter in plumbing, which splits water into two directions and is shaped like an uppercase T.

tee copies data from standard input to each FILE, and also to standard output. In effect, tee duplicates its input, routing it to multiple outputs at once.

Write output to stdout, and also to a file

The following command displays output only on the screen (stdout).
$ ls
The following command writes the output only to the file and not to the screen.
$ ls > file
The following command (with the help of tee command) writes the output both to the screen (stdout) and to the file.
$ ls | tee file

Write output from the middle of a pipe chain to a file and pass it back to the pipe 

You can also use tee command to store the output of a command in a file and redirect the same output to another command.
The following command will write current crontab entries to a file crontab-backup.txt and pass the crontab entries to sed command, which will do the substituion. After the substitution, it will be added as a new cron job.
$ crontab -l | tee crontab-backup.txt | sed 's/old/new/' | crontab

write the output to multiple files 

You can pipe your output to multiple files (including your terminal) by using tee like this:
$ ls | tee file1 file2 file3

Instruct tee command to append to the file 

By default tee command overwrites the file. You can instruct tee to append to the file using the –a option as shown below.
$ ls | tee –a file

Winter 10 Days bootcamp classes(7 HRS Daily) will start from 5 & 20 December 2019 in:
1) Internet of things(IoT) Using RASPBERRY-PI
2) Machine Learning (ML)

70% OFF| Fee-INR 3,000/-

Limited seats!! Hurry up!!

[[ CALL - 07976731765 ]]

Some Study Resources are compiled from original Stack Overflow Documentation, the content is developed by the different experts at Stack Overflow. Study resources are released under Creative Commons BY-SA. Images may be copyright of their respective owners. This website is for self-learning and not affiliated with Stack Overflow. All trademarks and registered trademarks are the property of their respective company owners. Please send feedback and corrections to chandwaglobal@gmail.com.

...