Copied to clipboard

tee

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

  1. Output the result of the command to both the screen and the file: ls -l | tee file.txt
  2. Append the output of the command to the file: ls -l | tee -a file.txt
  3. Ignore interrupt signals and continue executing the command: ls -l | tee -i file.txt
  4. Create the directory if it doesn't exist: ls -l | tee -p file.txt