I'm using iperf3 in Ubuntu 20.
When not writing to a log file, iperf3 can provide a report every second with the -i 1 option. Using the --logfile option redirects all output to the file and inhibits any terminal output.
One way to get both terminal and file output is to use tee:
NOW=$( date '+%F_%H-%M-%S' )
iperf3 -c 192.168.50.1 -p 5201 -R -i 1 -T 1str-$NOW | tee iperf-1str-log-$NOW.txt
In this case, iperf runs for 10 seconds and provides no output to the terminal. When the 10 second execution is complete, all 10 lines of output appear on the terminal at once.
How can I "flush" tee to the terminal after every line of input?
Or is there a different way to accomplish this?