title: Count total directories and files in all sub directories unix
body: <p>I am trying to get a count of the subdirectories and all the files total in all the subdirectories within a directory in Unix.  I tried this:</p>
  
  <pre><code>ls -lR | grep ^d | wc -l
  </code></pre>
  
  <p>but that just gives me the total subdirectories, not the total files.  How would I modify this or is there a way to find out both numbers from one command? Or should I split this into two? </p>