Redirect all output to a log file

When you build a program or execute a shell command, the messages are often outputted to both standard output and standard error. If you want to send all ‘printf’ to a log file, use the following command:

make > make.log 2>&1

“2>&1”  is the part that redirects standard error to standard out, allowing you to capture all messages.

Support CNX Software - Donate via PayPal or become a Patron on Patreon

2
Leave a Reply

avatar
1 Comment threads
1 Thread replies
0 Followers
 
Most reacted comment
Hottest comment thread
2 Comment authors
hari Recent comment authors
  Subscribe  
newest oldest most voted
Notify of
hari
Guest
hari

Also we can use : make 2>& | tee make.log
This will make sure you see the output both on terminal as well as on the File. Most of the times you need not look into the file to check if its successfully compiled.