snipt

Ctrl+h for KB shortcuts

Bash

find and delete all files in www directory ending in LCK

find www -name *.LCK -type f -print | xargs rm
https://snipt.net/embed/f9e719a0ea03053a15292d3fd58dbc59/
/raw/f9e719a0ea03053a15292d3fd58dbc59/
f9e719a0ea03053a15292d3fd58dbc59
bash
Bash
1
2019-07-31T00:23:50
True
False
False
/api/public/snipt/671/
find-and-delete-all-files-in-www-directory-ending-in-lck
<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></span><span id="L-1"><a name="L-1"></a>find www -name *.LCK -type f -print <span class="p">|</span> xargs rm </span></pre></div> </td></tr></table>
bash, linux, server

Bash

Drupal - fgrep - search for what is executed by functions

fgrep -R "theme('terms" *
https://snipt.net/embed/f57e3a1d5454ef4312f2f8fe7026c3c1/
/raw/f57e3a1d5454ef4312f2f8fe7026c3c1/
f57e3a1d5454ef4312f2f8fe7026c3c1
bash
Bash
1
2019-06-20T07:36:45
True
False
False
/api/public/snipt/572/
drupal-fgrep-search-for-what-is-executed-by-functions
<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></span><span id="L-1"><a name="L-1"></a>fgrep -R <span class="s2">&quot;theme(&#39;terms&quot;</span> * </span></pre></div> </td></tr></table>
bash, drupal, server

Bash

Reconfigure vhosts (Plesk)

/usr/local/psa/admin/sbin/websrvmng --reconfigure-vhost --vhost-name=DOMAINNAMEHERE.com
https://snipt.net/embed/698fa6f54022926b02d8d38aa8cfe052/
/raw/698fa6f54022926b02d8d38aa8cfe052/
698fa6f54022926b02d8d38aa8cfe052
bash
Bash
1
2019-07-08T01:42:46
True
False
False
/api/public/snipt/568/
reconfigure-vhosts-plesk
<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></span><span id="L-1"><a name="L-1"></a>/usr/local/psa/admin/sbin/websrvmng --reconfigure-vhost --vhost-name<span class="o">=</span>DOMAINNAMEHERE.com </span></pre></div> </td></tr></table>
bash, plesk, server

Bash

block IP addresses for CSF

csf -d <ipaddress>
https://snipt.net/embed/ed3ca246c6b83c79d331ea4121a3347c/
/raw/ed3ca246c6b83c79d331ea4121a3347c/
ed3ca246c6b83c79d331ea4121a3347c
bash
Bash
1
2019-07-06T23:24:46
True
False
False
/api/public/snipt/567/
block-ip-addresses-for-csf
<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></span><span id="L-1"><a name="L-1"></a>csf -d &lt;ipaddress&gt; </span></pre></div> </td></tr></table>
bash

Bash

show frequently used commands

history 1000 | awk '{a[$2]++}END{for(i in a){print a[i] " " i}}' | sort -rn | head
https://snipt.net/embed/55c7a0685ce9e4bf9e96eed9a3288164/
/raw/55c7a0685ce9e4bf9e96eed9a3288164/
55c7a0685ce9e4bf9e96eed9a3288164
bash
Bash
1
2019-08-11T00:07:19
True
False
False
/api/public/snipt/463/
show-frequently-used-commands
<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></span><span id="L-1"><a name="L-1"></a><span class="nb">history</span> <span class="m">1000</span> <span class="p">|</span> awk <span class="s1">&#39;{a[$2]++}END{for(i in a){print a[i] &quot; &quot; i}}&#39;</span> <span class="p">|</span> sort -rn <span class="p">|</span> head </span></pre></div> </td></tr></table>
bash

Bash

apply patch

patch -p0 < patch.txt
https://snipt.net/embed/d7434435766bb9bb67ed07db37d1c78b/
/raw/d7434435766bb9bb67ed07db37d1c78b/
d7434435766bb9bb67ed07db37d1c78b
bash
Bash
1
2019-08-15T13:44:45
True
False
False
/api/public/snipt/458/
apply-patch
<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></span><span id="L-1"><a name="L-1"></a>patch -p0 &lt; patch.txt </span></pre></div> </td></tr></table>
bash, linux, unix

Bash

nix memory sorted by RSS

ps -e -orss=,args= | sort -b -k1,1n | pr -TW$COLUMNS
https://snipt.net/embed/5c11347df014e70ec643fa3661779736/
/raw/5c11347df014e70ec643fa3661779736/
5c11347df014e70ec643fa3661779736
bash
Bash
1
2019-07-29T18:36:28
True
False
False
/api/public/snipt/449/
nix-memory-sorted-by-rss
<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></span><span id="L-1"><a name="L-1"></a>ps -e -orss<span class="o">=</span>,args<span class="o">=</span> <span class="p">|</span> sort -b -k1,1n <span class="p">|</span> pr -TW<span class="nv">$COLUMNS</span> </span></pre></div> </td></tr></table>
bash