Reputation: 5245
I have a large app output , and I should analyse the output.
It's difficult to do it on the terminal so I would print the output into a file to analyse it easier.
So how can I redirect nodejs app.js
output into a file in Ubuntu ?
Upvotes: 2
Views: 1101
Reputation: 1198
You can do it by redirecting your app's output (stdout and stderr) to the desired file:
$ node app.js &> filename.txt
If you do this, everything that you log using console.log() and console.err() will be included in your file.
Of course, it would be better if you programmatically write to a file so you can include only what you want to keep in the file.
Upvotes: 2