How do I capture all of my compiler's output to a file? How do I capture all of my compiler's output to a file? shell shell

How do I capture all of my compiler's output to a file?


The compiler warnings happen on stderr, not stdout, which is why you don't see them when you just redirect make somewhere else. Instead, try this if you're using Bash:

$ make &> results.txt

The & means "redirect stdout and stderr to this location". Other shells often have similar constructs.


In a bourne shell:

make > my.log 2>&1

I.e. > redirects stdout, 2>&1 redirects stderr to the same place as stdout


Lots of good answers so far. Here's a frill:

$ make 2>&1 | tee filetokeepitin.txt 

will let you watch the output scroll past.