How to write stdout both to the terminal and a file

Clarice Bouwer - May 4 '22 - - Dev Community

Below I use the tee command to write the output of an npm run build script to both to the terminal and to a log file.

npm run build | tee ./logs/build.log
Enter fullscreen mode Exit fullscreen mode
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .