unsplashunsplash

How to write stdout both to the terminal and a file

Estimated 1 minute readย ยทย Wednesday, 4 May 2022

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
We use essential cookies to make our site work. With your consent, we may also use non-essential cookies to improve user experience and analyze website traffic. By clicking 'Accept', you agree to our website's cookie use as described in our Privacy Policy.