snipt

Ctrl+h for KB shortcuts

Bash

get file size

file="/path/to/some/file"
size=$(du -sh "$file" 2>/dev/null | awk '{print $1}')
https://snipt.net/embed/50d37b912c2717665d2a4269be762565/
https://snipt.net/raw/50d37b912c2717665d2a4269be762565/
50d37b912c2717665d2a4269be762565
bash
Bash
2
2016-09-26T17:38:52
True
False
False
/api/public/snipt/141375/
get-file-size
<table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><a href="#L-1">1</a> <a href="#L-2">2</a></pre></div></td><td class="code"><div class="highlight"><pre><span id="L-1"><a name="L-1"></a><span class="nv">file</span><span class="o">=</span><span class="s2">&quot;/path/to/some/file&quot;</span> </span><span id="L-2"><a name="L-2"></a><span class="nv">size</span><span class="o">=</span><span class="k">$(</span>du -sh <span class="s2">&quot;</span><span class="nv">$file</span><span class="s2">&quot;</span> 2&gt;/dev/null <span class="p">|</span> awk <span class="s1">&#39;{print $1}&#39;</span><span class="k">)</span> </span></pre></div> </td></tr></table>
linux, size

PHP

Get attached file size

1
2
3
<?php
filesize( get_attached_file( $attachment->ID ) );
?>
https://snipt.net/embed/b6f8a64ff28dbbfbf082660c07534b17/
https://snipt.net/raw/b6f8a64ff28dbbfbf082660c07534b17/
b6f8a64ff28dbbfbf082660c07534b17
php
PHP
3
2016-09-25T10:20:58
True
False
False
Aug 01, 2013 at 07:11 AM
/api/public/snipt/71160/
get-attached-file-size
<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 id="L-1"><a name="L-1"></a><span class="cp">&lt;?php</span> </span><span id="L-2"><a name="L-2"></a><span class="nb">filesize</span><span class="p">(</span> <span class="nx">get_attached_file</span><span class="p">(</span> <span class="nv">$attachment</span><span class="o">-&gt;</span><span class="na">ID</span> <span class="p">)</span> <span class="p">);</span> </span><span id="L-3"><a name="L-3"></a><span class="cp">?&gt;</span><span class="x"></span> </span></pre></div> </td></tr></table>
attach, attached, file, get, size, wordpress, wp
https://snipt.net/embed/69799c4496789bbb8b968d076eb0d563/
https://snipt.net/raw/69799c4496789bbb8b968d076eb0d563/
69799c4496789bbb8b968d076eb0d563
bash
Bash
1
2016-09-26T19:32:34
True
False
False
/api/public/snipt/54332/
calcular-tamano-total-de-un-directorio-y-sus-sub-directorios
<table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><a href="#L-1">1</a></pre></div></td><td class="code"><div class="highlight"><pre><span id="L-1"><a name="L-1"></a>du -chs </span></pre></div> </td></tr></table>
folder, size

XML

Ubuntu Add Screen Size

xrandr --newmode "1440x900_60.00"  106.50  1440 1528 1672 1904  900 903 909 934 -hsync +vsync
xrandr --addmode VGA-0 1440x900
https://snipt.net/embed/2d70eb3df64f207a06a5c8880e17f409/
https://snipt.net/raw/2d70eb3df64f207a06a5c8880e17f409/
2d70eb3df64f207a06a5c8880e17f409
xml
XML
2
2016-09-25T12:39:06
True
False
False
/api/public/snipt/32852/
ubuntu-add-screen-size
<table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><a href="#L-1">1</a> <a href="#L-2">2</a></pre></div></td><td class="code"><div class="highlight"><pre><span id="L-1"><a name="L-1"></a>xrandr --newmode &quot;1440x900_60.00&quot; 106.50 1440 1528 1672 1904 900 903 909 934 -hsync +vsync </span><span id="L-2"><a name="L-2"></a>xrandr --addmode VGA-0 1440x900 </span></pre></div> </td></tr></table>
add, screen, size, ubuntu, xrandr

Bash

print folder size

# prints the folder size in KB
du -sk [dir]
https://snipt.net/embed/3586835d35fa18d3f73078b389f9cf25/
https://snipt.net/raw/3586835d35fa18d3f73078b389f9cf25/
3586835d35fa18d3f73078b389f9cf25
bash
Bash
2
2016-09-25T18:27:52
True
False
False
/api/public/snipt/18430/
print-folder-size
<table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><a href="#L-1">1</a> <a href="#L-2">2</a></pre></div></td><td class="code"><div class="highlight"><pre><span id="L-1"><a name="L-1"></a><span class="c"># prints the folder size in KB</span> </span><span id="L-2"><a name="L-2"></a>du -sk <span class="o">[</span>dir<span class="o">]</span> </span></pre></div> </td></tr></table>
folder, size
Copyrighted, illegal, or inappropriate content? Email support@snipt.net.