snipt

Ctrl+h for KB shortcuts

Bash

function for search biggest files

1
2
3
biggest () {
du | sort -r -n | awk '{split("k m g",v); s=1; while($1>1024){$1/=1024; s++} print int($1)" "v[s]"\t"$2}'
}
https://snipt.net/embed/fbc8f9ef7d1d5d6cbd58e98bd0851348/
/raw/fbc8f9ef7d1d5d6cbd58e98bd0851348/
fbc8f9ef7d1d5d6cbd58e98bd0851348
bash
Bash
3
2019-06-25T04:42:32
True
False
False
/api/public/snipt/7554/
function-for-search-biggest-files
<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></pre></div></td><td class="code"><div class="highlight"><pre><span></span><span id="L-1"><a name="L-1"></a>biggest <span class="o">()</span> <span class="o">{</span> </span><span id="L-2"><a name="L-2"></a>du <span class="p">|</span> sort -r -n <span class="p">|</span> awk <span class="s1">&#39;{split(&quot;k m g&quot;,v); s=1; while($1&gt;1024){$1/=1024; s++} print int($1)&quot; &quot;v[s]&quot;\t&quot;$2}&#39;</span> </span><span id="L-3"><a name="L-3"></a><span class="o">}</span> </span></pre></div> </td></tr></table>
"shell script", bash