title: How to redirect and append both standard output and standard error to a file with Bash
body: <p>To redirect <a href="https://en.wikipedia.org/wiki/Standard_streams#Standard_output_.28stdout.29" rel="noreferrer">standard output</a> to a truncated file in Bash, I know to use:</p>
  <pre><code>cmd &gt; file.txt
  </code></pre>
  <p>To redirect standard output in Bash, appending to a file, I know to use:</p>
  <pre><code>cmd &gt;&gt; file.txt
  </code></pre>
  <p>To redirect both standard output and <a href="https://en.wikipedia.org/wiki/Standard_streams#Standard_error_(stderr)" rel="noreferrer">standard error</a> to a truncated file, I know to use:</p>
  <pre><code>cmd &amp;&gt; file.txt
  </code></pre>
  <p>How do I redirect both standard output and standard error appending to a file? <code>cmd &amp;&gt;&gt; file.txt</code> did not work for me.</p>