"tee" Command in Linux

"tee" Command in Linux

Table of contents

No heading

No headings in the article.

Hey folks !! Back with the new blog on Linux. As I had challenged myself for #2Articles1week, here is the 2nd article of this week. Let's Start !!

-> The "tee" command is used to store and view (simultaneously) the output of any command in a file.

-> Basically it breaks the command's output of the file so that it can be displayed on the screen as well as saved into the file.

So Let's understand with the examples :

Example 1 :

$ echo "I had taken up the challenge on Hashnode" | tee filename

Here, the echo command displayed the line "I had taken up the challenge on Hashnode" and simultaneously this line was saved to the "filename" which I had not created, it was created with a tee command.

Example 2 :

Let's say you want to append or add some content in this "filename". For appending the content execute the tee command give "-a".

$ echo "Today Hahsnode 1st week challenge is completed" | tee -a filename

So, this is all about "tee" command. If you want to know more about tee command you can execute "man tee" in Linux.

-> If you ever wanted to know about any commands just execute "man <command>".

THANK YOU :)

You can follow me Amit Maurya for more Linux blogs and on Twitter too.