Redirect linux command output to a file as well as to the terminal
Simply pipe the output of your command to the tee command. See examples below. The tee command overwrites the output file. To append, use To send your output to multiple files, simply specify files one after the otherls | tee filename
$ ls | tee –a file
$ ls | tee –a file1 file2