tee to a compressed file
compression, shell, tee, unix
Solution
If you're OK having your output on stderr, you can redirect it:
some_command | tee /dev/stderr | bzip2 > log.bz2
This tees the output to both stdout and stderr (`| tee /dev/stderr`). Then it pipes the stdout to bzip2 (`| bzip2 > log.bz2`)
Problem
tee reads from standard input and writes to standard output and a file. ``` some_command |& tee log ``` Is that possible for tee to write to a compressed file? ``` some_command |& tee -some_option log.bz2 ``` If tee can not do that, is there any other command? I can redirect the output to a compressed file with ``` some_command |& bzip2 > log.bz2 ``` But with this command, the output to standard output is missing.