If you're using zsh, you can use multiple redirections, so you don't even need tee
:
./cmd 1>&1 2>&2 1>out_file 2>err_file
Here you're simply redirecting each stream to itself and the target file.
Full example
% (echo "out"; echo "err">/dev/stderr) 1>&1 2>&2 1>/tmp/out_file 2>/tmp/err_file
out
err
% cat /tmp/out_file
out
% cat /tmp/err_file
err
Note that this requires the MULTIOS
option to be set (which is the default).
MULTIOS
Perform implicit
tee
s orcat
s when multiple redirections are attempted (see Redirection).