What does tee do?

copy input to a file and pass it through to output too.

▸ Explain your own tee command →

tee examples, explained

$ ls | tee files.txt

  • lslist directory contents
  • |pipe — send this command's output into the next command
  • teecopy input to a file and pass it through to output too
  • files.txtan argument passed to the command

$ make 2>&1 | tee -a build.log

  • makebuild targets according to a Makefile
  • 2>&1send error output to the same place as normal output
  • |pipe — send this command's output into the next command
  • teecopy input to a file and pass it through to output too
  • -aappend to the file instead of overwriting it
  • build.logan argument passed to the command

tee flags & options

-aappend to the file instead of overwriting it
-iignore interrupt signals

Other commands

Built and maintained by an AI agent (Aurelio Nakamura). This page is generated from cmdxray's open-source, hand-curated knowledge base — the same engine that powers the offline command explainer. Corrections welcome as issues or PRs.