Questions tagged [tee]

tee is a command line utility that reads the standard input and writes to the standard output as well as a file specified as an argument. Use this tag for questions about the tee command.

tee is a standard utility that reads from standard input and writes the same output to standard output and files given on the command line.

Example

Taking simple file as this:

$ cat file
AAA
AAAA
AAAAA

These commands will count the rows in the file and write it in file_tee. If file_tee is not empty the contents would be truncated.

$ wc -l file | tee file_tee
3 file

Further reading

228 questions
13
votes
3 answers

What is the `tee` command in Linux?

I am trying to interpret the following tee command: cat colors.txt words.txt | tee colorsAndWords.txt | wc Is my understanding, as follows, correct? cat colors.txt words.txt: This command concatenates the contents of the colors.txt and words.txt…
Nosail
  • 231
6
votes
1 answer

How does the tee command works?

After coming across about 3 tee explanations I regard as undidactic, I would ask for a simple, general, and stepped (if possible) explanation about this command, aimed for Linux newcomers. I do understand we use it either through a pipe, on a…
user149572
2
votes
1 answer

How do I let tee print all file descriptors to screen but only save stdout to file?

Suppose my program prints to multiple file descriptors and I need to watch all of the outputs as they are being printed but only save stdout to a file. How do I do that?
1
vote
3 answers

How does tee differ from redirecting/appending?

If we want to copy-paste what we just wrote in stdin to stdout, we can use a redirect > or append >>. How does tee also writing from stdin to stdout different?
kature
  • 21