<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0"><channel><title>Tech-Recipes - Latest Comments in Tar and compress a file in one step</title><link>http://tech-recipes.disqus.com/</link><description>Cookbook of Tech Tutorials</description><language>en</language><lastBuildDate>Wed, 11 Mar 2009 17:11:34 -0000</lastBuildDate><item><title>Re: Tar and compress a file in one step</title><link>http://www.tech-recipes.com/rx/64/tar-and-compress-a-file-in-one-step/#comment-7111446</link><description>it would be:&lt;br&gt;&lt;br&gt;tar -cf - /home/eaips/var/fileName | gzip -c &amp;gt; /home/eaips/var/fileName.tar.gz</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">qmchenry</dc:creator><pubDate>Wed, 11 Mar 2009 17:11:34 -0000</pubDate></item><item><title>Re: Tar and compress a file in one step</title><link>http://www.tech-recipes.com/rx/64/tar-and-compress-a-file-in-one-step/#comment-7107346</link><description>I have following two steps in my script, how club them and do it in a single step ?&lt;br&gt;&lt;br&gt;tar  -cf  /home/eaips/var/fileName.tar  /home/eaips/var/fileName&lt;br&gt;gzip /home/eaips/var/fileName.tar</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Satish</dc:creator><pubDate>Wed, 11 Mar 2009 14:40:21 -0000</pubDate></item><item><title>Re: Tar and compress a file in one step</title><link>http://www.tech-recipes.com/rx/64/tar-and-compress-a-file-in-one-step/#comment-2766830</link><description>If  you wanna try something a little bit funnier, tar and zip a file, then unzip and untar it in another directory in only one step (this is usefull to keep symlinks unchanged)&lt;br&gt;&lt;br&gt;tar -cvf - mySelection | gzip -c  | (cd myNewDirectory ; gzip -dc | tar xvf -)&lt;br&gt;&lt;br&gt;make this match to your own needs...</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Hseb72</dc:creator><pubDate>Thu, 14 Oct 2004 05:21:21 -0000</pubDate></item><item><title>Re: Tar and compress a file in one step</title><link>http://www.tech-recipes.com/rx/64/tar-and-compress-a-file-in-one-step/#comment-2766829</link><description>Although this probably belongs under the OpenSSH section, this is a really neat trick for snapping a tarball of a machine with limited diskspace, and storing the output on your workstation (or machine that your SSH'ing from).&lt;br&gt;&lt;br&gt;You must already have the hostkey from the remote machine (i.e., logged in at least once) otherwise this will fail.  SSH allows you to connect to a remote machine and pass a commandline rather than firing up an interactive shell.  The output is then dumped to your local console for further processing.&lt;br&gt;&lt;br&gt;Before you scratch your head, think of this.  You have a machine that has virtually no space left (or at least, not enough to make that tarball).  qmchenry's post shows you how to get tar to spool the archive to stdout:&lt;br&gt;&lt;br&gt;&lt;code&gt;&lt;br&gt;tar -cf - target&lt;br&gt;&lt;/code&gt;&lt;br&gt;&lt;br&gt;&lt;br&gt;What if you can capture that to your own workstation, which probably has ample space.   Picture this:&lt;br&gt;&lt;br&gt;&lt;code&gt;&lt;br&gt;ssh user@remotemachine &amp;quot;cd /path;tar -cf - target | gzip -c&amp;quot; &amp;gt; /path/target.tgz&lt;br&gt;&lt;/code&gt;&lt;br&gt;&lt;br&gt;&lt;br&gt;You've just had the remote machine produce a tarball, run it through gzip,  and dump the results to stdout.  You just captured that at your own workstation, and saved the results.</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">bofh468</dc:creator><pubDate>Thu, 13 Nov 2003 16:02:20 -0000</pubDate></item></channel></rss>