User Tools

Site Tools


using_tee_to_output_to_file_and_screen

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
using_tee_to_output_to_file_and_screen [2016/08/03 22:42] walkeradminusing_tee_to_output_to_file_and_screen [2023/03/09 22:35] (current) – external edit 127.0.0.1
Line 1: Line 1:
 ====== Using Tee to Output to File and Screen ====== ====== Using Tee to Output to File and Screen ======
-\\  +<color darkorange>2016</color>
-\\ +
  
-this is unfinished....... +----
- +
- +
- +
-when you want to redirect the output of a command to a file you can use the redirector > +
- +
- +
-/mnt/usbstorage/backups/scripts/pibackup | tee /mnt/usbstorage/backups/logs/$(date '+%Y-%m-%d').log+
  
 +\\ 
 +<color red>NOTE:- </color>While this works fine for scripts run from the command line, I found anything run by CRON failed if this format was used (this was on Raspbian Jessie).
 +\\ 
 +\\ 
 +When you want to redirect the output of a command to a file you can use the redirector **>**
 +\\ 
 +    ls -al > result.log
 +\\ 
 +However, this means that you see nothing on the screen, to avoid this use the **Tee** Command:
 +\\ 
 +    ls -al | tee result.log
 +\\ 
 +Now you get the result on both the screen and in the file.
 +\\ 
 +\\ 
using_tee_to_output_to_file_and_screen.1470260548.txt.gz · Last modified: 2023/03/09 22:35 (external edit)