snipt

Ctrl+h for KB shortcuts

Bash

Estimate File Size Usage

# Using: 
# 'du' with -S for not including size of subdirectories, 
# and -h is to see on human-readable form (changing bytes to gb or mb);
#
# 'sort' with -n for indexing comparing numerical string values
# and -r to reverse the order of the sort;
#
# 'more' to see the output in parts.

du -Sh | sort -n -r | more
https://snippets.siftie.com/embed/62cdd8089119ad487bdf0ca7fd1de361/
/raw/62cdd8089119ad487bdf0ca7fd1de361/
62cdd8089119ad487bdf0ca7fd1de361
bash
Bash
10
2019-03-20T01:45:49
True
False
False
/api/public/snipt/48137/
estimate-file-size-usage
<table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><a href="#L-1"> 1</a> <a href="#L-2"> 2</a> <a href="#L-3"> 3</a> <a href="#L-4"> 4</a> <a href="#L-5"> 5</a> <a href="#L-6"> 6</a> <a href="#L-7"> 7</a> <a href="#L-8"> 8</a> <a href="#L-9"> 9</a> <a href="#L-10">10</a></pre></div></td><td class="code"><div class="highlight"><pre><span></span><span id="L-1"><a name="L-1"></a><span class="c1"># Using: </span> </span><span id="L-2"><a name="L-2"></a><span class="c1"># &#39;du&#39; with -S for not including size of subdirectories, </span> </span><span id="L-3"><a name="L-3"></a><span class="c1"># and -h is to see on human-readable form (changing bytes to gb or mb);</span> </span><span id="L-4"><a name="L-4"></a><span class="c1">#</span> </span><span id="L-5"><a name="L-5"></a><span class="c1"># &#39;sort&#39; with -n for indexing comparing numerical string values</span> </span><span id="L-6"><a name="L-6"></a><span class="c1"># and -r to reverse the order of the sort;</span> </span><span id="L-7"><a name="L-7"></a><span class="c1">#</span> </span><span id="L-8"><a name="L-8"></a><span class="c1"># &#39;more&#39; to see the output in parts.</span> </span><span id="L-9"><a name="L-9"></a> </span><span id="L-10"><a name="L-10"></a>du -Sh <span class="p">|</span> sort -n -r <span class="p">|</span> more </span></pre></div> </td></tr></table>
"File Size", Bash