snipt

Ctrl+h for KB shortcuts

Bash

Compact tar.bz2 and on destination

1
2
3
#This is useful when you don't have much space on server, and need backup or copy
#So, you can backup direct to destination.
tar -cf - /home/dir_backup |bzip2 -9vv | ssh [email protected] "cat > /backups/dir_backup.tar.bz2"
https://snipt.net/embed/ff3556c4d1185c97e7eacbd696ca6a35/
/raw/ff3556c4d1185c97e7eacbd696ca6a35/
ff3556c4d1185c97e7eacbd696ca6a35
bash
Bash
4
2019-08-19T19:31:51
True
False
False
Sep 29, 2012 at 03:39 PM
/api/public/snipt/47820/
compact-tarbz2-and-on-destination
<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></span><span id="L-1"><a name="L-1"></a><span class="c1">#This is useful when you don&#39;t have much space on server, and need backup or copy</span> </span><span id="L-2"><a name="L-2"></a><span class="c1">#So, you can backup direct to destination.</span> </span><span id="L-3"><a name="L-3"></a>tar -cf - /home/dir_backup <span class="p">|</span>bzip2 -9vv <span class="p">|</span> ssh [email protected] <span class="s2">&quot;cat &gt; /backups/dir_backup.tar.bz2&quot;</span> </span></pre></div> </td></tr></table>
backup, bz2, bzip2, ssh, tar, tar.bz2

Bash

Import database as bz2 in MySQL

bunzip2 < my_database.sql.bz2 | mysql -h localhost -u root -p my_database
https://snipt.net/embed/d573c7db45b8611369552f1e2d714797/
/raw/d573c7db45b8611369552f1e2d714797/
d573c7db45b8611369552f1e2d714797
bash
Bash
1
2019-08-24T02:56:16
True
False
False
/api/public/snipt/25091/
import-database-as-bz2-in-mysql
<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>bunzip2 &lt; my_database.sql.bz2 <span class="p">|</span> mysql -h localhost -u root -p my_database </span></pre></div> </td></tr></table>
bz2, import, mysql