write the output to the file from command line

When you want to save the ter­mi­nal logs into an exter­nal file, you can pipe the out­put as following.

This is really help­ful when ter­mi­nal com­mands spit out a lot of infor­ma­tion and which is hard to edit. You can pipe the out­put to the file and read it with syn­tax high­light­ing and use all the rich fea­ture of mod­ern text editors.

<command> 2>&1 | tee foo.txt

Replace, the com­mand with your com­mand. For exam­ple, grunt unittest

You may also like...