write the output to the file from command line


When you want to save the terminal logs into an external file, you can pipe the output as following.

This is really helpful when terminal commands spit out a lot of information and which is hard to edit. You can pipe the output to the file and read it with syntax highlighting and use all the rich feature of modern text editors.

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

Replace, the command with your command. For example, grunt unittest



You may also like...