There are a few occasions when you might want to display the output of a command and then capture its output to a file at the same time. Here is an example below.
File capture_file is created and then appended to by the tee command.
# date > capture_file; ls -l /etc | tee -a capture_file
Here is another example of output going to the screen and then appended to a file.
# echo " " >> capture_file
# echo " " >> capture_file
# cat myfile1 | tee -a capture_file
# cat myfile2 | tee -a capture_file
No comments:
Post a Comment