snipt

Ctrl+h for KB shortcuts

Text only

Improved "Find Large Files" Command

du -k | sort -n | perl -ne 'if ( /^(\d+)\s+(.*$)/){$l=log($1+.1);$m=int($l/log(1024)); printf ("%6.1f\t%s\t%25s | %s\n",($1/(2**(10*$m))),(("K","M","G","T","P")[$m]),"*"x (1.5*$l),$2);}'
https://snipt.net/embed/99e2854c2ed77ac7c161a0ecf3e56713/
https://snipt.net/raw/99e2854c2ed77ac7c161a0ecf3e56713/
99e2854c2ed77ac7c161a0ecf3e56713
text
Text only
1
2016-09-25T18:19:47
True
False
False
/api/public/snipt/27619/
improved-find-large-files-command
<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 -k | sort -n | perl -ne &#39;if ( /^(\d+)\s+(.*$)/){$l=log($1+.1);$m=int($l/log(1024)); printf (&quot;%6.1f\t%s\t%25s | %s\n&quot;,($1/(2**(10*$m))),((&quot;K&quot;,&quot;M&quot;,&quot;G&quot;,&quot;T&quot;,&quot;P&quot;)[$m]),&quot;*&quot;x (1.5*$l),$2);}&#39; </span></pre></div> </td></tr></table>
"disk space", "disk usage", (dv), disk

Bash

awk find access_log

1
2
3
4
5
awk '$1~/THINGYOUWANT/' /var/www/vhosts/*/statistics/logs/access_log | head

#or for all occurrences use below, head only prints top 10 lines

awk '$1~/THINGYOUWANT/' /var/www/vhosts/*/statistics/logs/access_log
https://snipt.net/embed/7951001243c239f0e511b734863bc06f/
https://snipt.net/raw/7951001243c239f0e511b734863bc06f/
7951001243c239f0e511b734863bc06f
bash
Bash
5
2016-09-25T19:31:19
True
False
False
/api/public/snipt/8055/
awk-find-access_log
<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></pre></div></td><td class="code"><div class="highlight"><pre><span id="L-1"><a name="L-1"></a>awk <span class="s1">&#39;$1~/THINGYOUWANT/&#39;</span> /var/www/vhosts/*/statistics/logs/access_log <span class="p">|</span> head </span><span id="L-2"><a name="L-2"></a> </span><span id="L-3"><a name="L-3"></a><span class="c">#or for all occurrences use below, head only prints top 10 lines</span> </span><span id="L-4"><a name="L-4"></a> </span><span id="L-5"><a name="L-5"></a>awk <span class="s1">&#39;$1~/THINGYOUWANT/&#39;</span> /var/www/vhosts/*/statistics/logs/access_log </span></pre></div> </td></tr></table>
(dv), access_log, awk, find, linux, server, unix
https://snipt.net/embed/321a8842a2becae7d949d810335ee32d/
https://snipt.net/raw/321a8842a2becae7d949d810335ee32d/
321a8842a2becae7d949d810335ee32d
bash
Bash
1
2016-09-26T01:01:16
True
False
False
/api/public/snipt/3251/
gs-dv-migration-localhost-check
<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>grep -rl <span class="s1">&#39;localhost&#39;</span> * </span></pre></div> </td></tr></table>
(dv), (gs), dedicated-virtual, grep, grid-service, localhost, server, ssh

Text only

View Mail Queue

/var/qmail/bin/qmail-qstat
https://snipt.net/embed/a5c9b4496c503d4b56155b2873fe1817/
https://snipt.net/raw/a5c9b4496c503d4b56155b2873fe1817/
a5c9b4496c503d4b56155b2873fe1817
text
Text only
1
2016-09-22T17:30:02
True
False
False
/api/public/snipt/2211/
view-mail-queue
<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>/var/qmail/bin/qmail-qstat </span></pre></div> </td></tr></table>
(dv), mail, qmail

Text only

Restart Mail SubSystem

/usr/local/psa/admin/bin/mailmng -o ; /usr/local/psa/admin/bin/mailmng -p ; /etc/init.d/xinetd restart ; /etc/init.d/qmail restart 
https://snipt.net/embed/0e7c202e6667e9cdb5c14b804ef1fe53/
https://snipt.net/raw/0e7c202e6667e9cdb5c14b804ef1fe53/
0e7c202e6667e9cdb5c14b804ef1fe53
text
Text only
1
2016-09-22T17:30:10
True
False
False
/api/public/snipt/2210/
restart-mail-subsystem
<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>/usr/local/psa/admin/bin/mailmng -o ; /usr/local/psa/admin/bin/mailmng -p ; /etc/init.d/xinetd restart ; /etc/init.d/qmail restart </span></pre></div> </td></tr></table>
(dv), mail, qmail

Text only

Reconfigure mail settings on a mediatemple (dv) 3.5

/usr/local/psa/admin/sbin/mchk --with-spam
https://snipt.net/embed/5c09459b1982015bfb1274ddb516be68/
https://snipt.net/raw/5c09459b1982015bfb1274ddb516be68/
5c09459b1982015bfb1274ddb516be68
text
Text only
1
2016-09-26T11:55:07
True
False
False
/api/public/snipt/2207/
reconfigure-mail-settings-on-a-mediatemple-dv-35
<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>/usr/local/psa/admin/sbin/mchk --with-spam </span></pre></div> </td></tr></table>
(dv), 3.5, mchk, mediatemple
Copyrighted, illegal, or inappropriate content? Email support@snipt.net.