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-07-19T09:23:50
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

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-07-22T07:09:30
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]:/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-07-23T05:05:54
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

Bash

unzip and import db

gunzip < backup.sql.gz | mysql -u root -p dbname
https://snipt.net/embed/058a54b6f5c6be5b02e1afcede9dbdec/
/raw/058a54b6f5c6be5b02e1afcede9dbdec/
058a54b6f5c6be5b02e1afcede9dbdec
bash
Bash
1
2019-07-11T14:59:55
True
False
False
/api/public/snipt/34170/
unzip-and-import-db
<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>gunzip &lt; backup.sql.gz <span class="p">|</span> mysql -u root -p dbname </span></pre></div> </td></tr></table>
mysql, ssh