Authored by: soob
use:

|& tee filename

This both displays the output normally to stdout (usually your screen) and redirects a copy to the file you've given.

For example, I like to keep logs of all my configures and makes for the various unix utilities and tools I install. So I'll use commands like

./configure |& tee ~/Documents/logs/zsh-4.0.4-configure.log

and

sudo make install |& tee ~/Documents/logs/zsh-4.0.4-install.log