title: Redirect all output to file using Bash on Linux?
body: <p>I am trying to redirect all output from a command line programme to a file.  I am using Bash.  Some of the output is directed to a the file, but some still appears in the terminal and is not stored to the file.  </p>
  
  <p>Similar symptoms are described here:</p>
  
  <p><a href="https://stackoverflow.com/questions/6674327/redirect-all-output-to-file">Redirect all output to file</a></p>
  
  <p>However I have tried the proposed solution (capture stderr) without success:</p>
  
  <pre><code>&lt;cmd&gt; &lt;args&gt; &gt; stdout.txt 2&gt; stderr.txt
  </code></pre>
  
  <p>The file stderr.txt is created but is empty.</p>
  
  <p>A possible clue is that the command-line programme is a client communicating with a server on the same machine.  It may be that some of the output is coming from the <strong>server</strong>.  </p>
  
  <p>Is there a way to capture all the output from the terminal, irrespective of its origin?</p>
  
  <p><strong>EDIT:</strong></p>
  
  <p>I've confirmed that the missing output is generated by the server.  Running the command in a separate terminal causes some output in both terminals, I can pipe all the output from the command terminal to a file.  This raises issues about how to capture the server output, but that's a different question.</p>