tee

Redirect output to multiple files, copies standard input to standard output and also to any files given as arguments. This is useful when you want not only to send some data down a pipe, but also to save a copy.

Syntax
      tee [options]... [file]...

Options
   -a
   --append
        Append standard input to the given files rather than overwriting
        them.

   -i
   --ignore-interrupts'
        Ignore interrupt signals.

The tee utility does not buffer its output when writing to a pipe.

If a file being written to does not already exist, it is created.
If a file being written to already exists, the data it previously contained is overwritten unless the '-a' option is used.

The name tee is derived from plumbing terminology: T for a T-shaped pipe splitter.

Examples

ps -ax | tee processes.txt | more

"Twenty years from now, you will be more disappointed by the things you didn’t do than by the ones you did do. So throw off the bowlines, sail away from the safe harbour. Catch the trade winds in your sails. Explore. Dream. Discover” ~ Mark Twain

Related Linux commands

echo - Display message on screen.
head - Output the first part of file(s)
less - Display output one screen at a time.
more - Display output one screen at a time .
pg - Display one page at a time.
Equivalents in Windows Batch/Perl Script - TEE Scripts


 
Copyright © 1999-2025 windevcluster.com
Some rights reserved