You can use the Tee command If you want to save the output to a file and want to see the output on the screen.
Linux Tee Command detailed
Function Description: Read the standard input data, and output its contents as a file.
Syntax: Tee [-ai][--help][--version][file ...]
Supplemental NOTE: The tee instruction reads data from a standard input device, outputs its contents to a standard output device, and saves it as a file.
Parameters
-A or--append is attached to the back of the existing file, rather than overwriting it.
-i-i or--ignore-interrupts ignores interrupt signals.
--help online Help.
--version Displays version information.
Note that when using a pipe line, the standard error output from the previous command is not read by the tee.
a direct overwrite log file
# Ls-l | Tee./t.log
# Make | Tee Make.log
b Attach the output to the log file
# Ls-l | Tee-a./t.log
# Make Image | Tee-a Make_image.log