how to read from the stderr and stdout buffer?
I am running a command (say like a tcpdump packet capture ) and the packets details are written into the stdout and stderr. Is there a way to read from the stdout and stderr while the command is still executing?
I already tried the storing the stdout and stderr to a file using
tcpdump >log.txt 2>&1
But in this case the log.txt file is accessible only after the entire capture is over.
Is there a way to retrieve the contents of stdout and stderr while the command is still executing (storing to a variable is also ok )