Syntax of tee command
tee [option] [file]
tee command options
To get help with tee command and display all options available for tee command use
tee --help command.
tee command usage with examples
free | tee memory.txt
Here I am using tee command pipe with free command and output of free command will be copied into memory.txt file.
By default, tee command overwrites the file. Using tee command with -a option do not overwrite the file but append it to the given file.
I am using tee command pipe with wc command. wc command is used for count number of lines, words and bytes count of a file. Here
wc memory.txt | tee -a memory.txt display
wc memory.txt | tee -a memory.txt
date | tee -a date.txt memory.txt
free | tee date.txt
echo learning tee command with programbr | tee -a date.txt