Jump to content

Recommended Posts

Posted

<div class="KonaBody"><p><img src="http://osxdaily.com/wp-content/uploads/2012/04/create-tar-gz.jpg" alt="How to Create a Tar GZip Archive Bundle " title="create-tar-gz" width="620" height="87" class="aligncenter size-full wp-image-29170" /></p>

<p>You’re probably familiar with <a href="http://osxdaily.com/2012/01/10/how-to-zip-files-in-mac-os-x/">making your own zip files</a> if you’ve ever needed to transfer a group of files or if you’re managing your own backups outside of Time Machine. Using the GUI zip tools are easy and user friendly, but if you want some more advanced options with better compression you can turn to the command line to make a tar and gzip archive. The syntax will be the same in Mac OS X as it is in Linux.</p>

<h2 style="font-size:1.2em;">Creating a Tar GZip Archive Bundle</h2>

<p>From the command line (/Applications/Terminal/), use the following syntax:</p>

<p><code>tar -cvzf tarballname.tar.gz itemtocompress</code></p>

<p>For example, to compress a directories jpg files only, you’d type:</p>

<p><code>tar -cvzf jpegarchive.tar.gz /path/to/images/*.jpg</code></p>

<p>The * is a wildcard here, meaning anything with a .jpg extension will be compressed into the jpegarchive.tar.gz file and nothing else.</p>

<p>The resulting .tar.gz file is actually the product of two different things, tar basically just packages a group of files into a single file bundle but doesn’t offer compression on it’s own, thus to compress the tar you’ll want to add the highly effective gzip compression. You can run these as two separate commands if you really want to, but there isn’t much need because the tar command offers the -z flag which lets you automatically gzip the tar file. </p>

<h2 style="font-size:1.2em;">Opening .tar.gz Archives</h2>

<p>Unpacking the gz and tar files can be done with applications like <a href="http://osxdaily.com/2012/01/30/extract-installer-package-files-mac-os-x-pacifist/">Pacifist</a> or <a href="http://itunes.apple.com/us/app/the-unarchiver/id425424353?mt=12">Unarchiver</a> (free), or by going back to the command line with:</p>

<p><code>gunzip filename.tar.gz</code></p>

<p>Followed by:</p>

<p><code>tar -xvf filename.tar</code></p>

<p>Generally you should untar things into a directory, or the present working directory will be the destination which can get messy quick.</p>

</div>

<p><a href="http://feedads.g.doubleclick.net/~a/F-FdOnxzJmJ18m5acjptxe7T6Lk/0/da"><img src="http://feedads.g.doubleclick.net/~a/F-FdOnxzJmJ18m5acjptxe7T6Lk/0/di" border="0" ismap="true"></img></a><br/>

<a href="http://feedads.g.doubleclick.net/~a/F-FdOnxzJmJ18m5acjptxe7T6Lk/1/da"><img src="http://feedads.g.doubleclick.net/~a/F-FdOnxzJmJ18m5acjptxe7T6Lk/1/di" border="0" ismap="true"></img></a></p><div class="feedflare">

<a href="http://feeds.feedburner.com/~ff/osxdaily?a=19ihg18k3Vs:dK3meuWN8pA:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/osxdaily?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/osxdaily?a=19ihg18k3Vs:dK3meuWN8pA:V_sGLiPBpWU"><img src="http://feeds.feedburner.com/~ff/osxdaily?i=19ihg18k3Vs:dK3meuWN8pA:V_sGLiPBpWU" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/osxdaily?a=19ihg18k3Vs:dK3meuWN8pA:D7DqB2pKExk"><img src="http://feeds.feedburner.com/~ff/osxdaily?i=19ihg18k3Vs:dK3meuWN8pA:D7DqB2pKExk" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/osxdaily?a=19ihg18k3Vs:dK3meuWN8pA:7Q72WNTAKBA"><img src="http://feeds.feedburner.com/~ff/osxdaily?d=7Q72WNTAKBA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/osxdaily?a=19ihg18k3Vs:dK3meuWN8pA:qj6IDK7rITs"><img src="http://feeds.feedburner.com/~ff/osxdaily?d=qj6IDK7rITs" border="0"></img></a>

</div><img src="http://feeds.feedburner.com/~r/osxdaily/~4/19ihg18k3Vs" height="1" width="1"/>

 

View the full article

  • Replies 0
  • Created
  • Last Reply

Top Posters In This Topic

Popular Days

Top Posters In This Topic

Popular Days


×
×
  • Create New...