How to redirect/save the console to a file and keep it visible on the screen

batchcommand-line-interfaceconsoleredirect

I want to save a program's output (stdout) to a file but still be able to see the output on the screen in realtime.

I need a solutions for both Linux and Windows.

Best Answer

In Linux, you can use the tee utility.

In Windows, PowerShell contains a tee cmdlet. For cmd, you will need to download and install a separate utility.