title: Delete all files except the newest 3 in bash script
body: <p><strong>Question:</strong> How do you delete all files in a directory except the newest 3?</p>
  
  <p>Finding the newest 3 files is simple:</p>
  
  <pre><code>ls -t | head -3
  </code></pre>
  
  <p>But I need to find all files except the newest 3 files. How do I do that, and how do I delete these files in the same line without making an unnecessary for loop for that?</p>
  
  <p>I'm using Debian Wheezy and bash scripts for this.</p>