The tee command copies standard input to both standard output and one or more files, thus allowing the data to be seen on the display and saved in a file.
$
e.g. ls -l
Examples
Output the result of the command to both the screen and the file: ls -l | tee file.txt
Append the output of the command to the file: ls -l | tee -a file.txt
Ignore interrupt signals and continue executing the command: ls -l | tee -i file.txt
Create the directory if it doesn't exist: ls -l | tee -p file.txt