program_name |tee logfile
这样程序执行期间的显示都记录到logfile同时显示到标准输出(屏幕)。
[zhanghua@localhost ZA]$ man tee
TEE(1) FSF TEE(1)
NAME
tee - read from standard input and write to standard output and files
SYNOPSIS
tee [OPTION]... [FILE]...
DESCRIPTION
Copy standard input to each FILE, and also to standard output.
-a, --append
append to the given FILEs, do not overwrite
-i, --ignore-interrupts
ignore interrupt signals
--help display this help and exit
--version
output version information and exit