384
edits
Changes
→Overview: du Improved
= Overview: du Improved =
<code>du</code> is a tool for inspecting directories. It will return the contents of a directory along with how much drive space they are using. However, it can be parse its output quickly, as it usually returns file sizes as a number of bytes:
<code><b>user@host ~ $ du --max-depth 1 /usr/local/lib</b></code><pre><code>
164028 /usr/local/lib/heroku
11072 /usr/local/lib/python2.7
An example of the finished code your script might produce is this:
<code><b>user@host ~ $ ./duim.py /usr/local/lib</b></code><pre><code>
61 % [============ ] 160.2 MiB /usr/local/lib/heroku
4 % [= ] 10.8 MiB /usr/local/lib/python2.7