snipt

Ctrl+h for KB shortcuts

Bash

Clear contents of file but dont delete it

cat /dev/null > file
https://snipt.net/embed/bb4c74f5bb5471cfee5e14aa071214d5/
/raw/bb4c74f5bb5471cfee5e14aa071214d5/
bb4c74f5bb5471cfee5e14aa071214d5
bash
Bash
1
2019-06-13T11:22:27
True
False
False
Sep 03, 2013 at 05:12 AM
/api/public/snipt/78646/
clear-contents-of-file-but-dont-delete-it
<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>cat /dev/null &gt; file </span></pre></div> </td></tr></table>
bash, clear, linux, ssh

Bash

Drush cron

drush cron -v
https://snipt.net/embed/2bba4c24cc9a888c96da07f38d91cf1b/
/raw/2bba4c24cc9a888c96da07f38d91cf1b/
2bba4c24cc9a888c96da07f38d91cf1b
bash
Bash
1
2019-06-11T10:54:26
True
False
False
/api/public/snipt/44213/
drush-cron
<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>drush cron -v </span></pre></div> </td></tr></table>
bash, cron, drupal, drush

Text only

PHP cli on Mamp for Mac OSx

1
2
3
4
5
6
Edit or create the file: /Users/*userdir*/.profile and insert the line:

> export PATH=/Applications/MAMP/bin/php5.3/bin:$PATH

or equivalent path of MAMP php installation.
On next Terminal session it will use MAMP php executable instead of OSX default (thus enabling the use of cli for use with frameworks and like).
https://snipt.net/embed/854c3df975e7076b0a8a32f269654b20/
/raw/854c3df975e7076b0a8a32f269654b20/
854c3df975e7076b0a8a32f269654b20
text
Text only
6
2019-06-14T10:32:31
True
False
False
/api/public/snipt/43352/
php-cli-on-mamp-for-mac-osx
<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></pre></div></td><td class="code"><div class="highlight"><pre><span></span><span id="L-1"><a name="L-1"></a>Edit or create the file: /Users/*userdir*/.profile and insert the line: </span><span id="L-2"><a name="L-2"></a> </span><span id="L-3"><a name="L-3"></a>&gt; export PATH=/Applications/MAMP/bin/php5.3/bin:$PATH </span><span id="L-4"><a name="L-4"></a> </span><span id="L-5"><a name="L-5"></a>or equivalent path of MAMP php installation. </span><span id="L-6"><a name="L-6"></a>On next Terminal session it will use MAMP php executable instead of OSX default (thus enabling the use of cli for use with frameworks and like). </span></pre></div> </td></tr></table>
MAMP, mac, osx, php

Bash

Rename files beginning with F (change as appropriate)

rename --no-act 's/^f//' f*
https://snipt.net/embed/37ccd47fc08540f67b762ecb573fe95d/
/raw/37ccd47fc08540f67b762ecb573fe95d/
37ccd47fc08540f67b762ecb573fe95d
bash
Bash
1
2019-06-14T21:50:12
True
False
False
/api/public/snipt/42508/
rename-files-beginning-with-f-change-as-appropriate
<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>rename --no-act <span class="s1">&#39;s/^f//&#39;</span> f* </span></pre></div> </td></tr></table>

Bash

Remove all .svn folders on a directory

find . -type d -name .svn -exec rm -rf {} +
https://snipt.net/embed/8678ce1e40b2a0d9f56e824f8470f665/
/raw/8678ce1e40b2a0d9f56e824f8470f665/
8678ce1e40b2a0d9f56e824f8470f665
bash
Bash
1
2019-05-28T06:44:13
True
False
False
/api/public/snipt/39417/
remove-all-svn-folders-on-a-directory
<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 . -type d -name .svn -exec rm -rf <span class="o">{}</span> + </span></pre></div> </td></tr></table>
bash, svn

Bash

remove files over certain size

find . -type f -size +5M -exec rm {} +  
https://snipt.net/embed/2ebd7cbc09208ecef4937a77ce4bf20b/
/raw/2ebd7cbc09208ecef4937a77ce4bf20b/
2ebd7cbc09208ecef4937a77ce4bf20b
bash
Bash
1
2019-05-29T07:32:25
True
False
False
/api/public/snipt/39150/
remove-files-over-certain-size
<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 . -type f -size +5M -exec rm <span class="o">{}</span> + </span></pre></div> </td></tr></table>
bash, server

Bash

rsync move files to server

rsync -arzv -e ssh folder [email protected]:/destination-folder
https://snipt.net/embed/5257113eb28985496906572ddb047234/
/raw/5257113eb28985496906572ddb047234/
5257113eb28985496906572ddb047234
bash
Bash
1
2019-05-28T20:15:37
True
False
False
/api/public/snipt/38711/
rsync-move-files-to-server
<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>rsync -arzv -e ssh folder [email protected]ip:/destination-folder </span></pre></div> </td></tr></table>
rsync, ssh

Bash

drush change password script for drupal 7 users

drush user-password someuser --password="[email protected]@$s"
https://snipt.net/embed/b57caad6f1d96c22b9c7065da64a9d64/
/raw/b57caad6f1d96c22b9c7065da64a9d64/
b57caad6f1d96c22b9c7065da64a9d64
bash
Bash
1
2019-06-10T03:57:50
True
False
False
/api/public/snipt/36890/
drush-change-password-script-for-drupal-7-users
<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>drush user-password someuser --password<span class="o">=</span><span class="s2">&quot;[email protected]@</span><span class="nv">$s</span><span class="s2">&quot;</span> </span></pre></div> </td></tr></table>
drupal, drupal7, drush, ssh