Optimizing your experience
unsplashunsplash
Gradient background

How to write stdout both to the terminal and a file

Clarice Bouwer

Software Engineering Team Lead and Director of Cloudsure

Wednesday, 4 May 2022 · Estimated 1 minute read

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.

Copy
npm run build | tee ./logs/build.log