Compressing Cheat Sheet

  • Published on
    15-Sep-2015

  • View
    213

  • Download
    0

Embed Size (px)

DESCRIPTION

How to compress files and folders from the terminal

Transcript

<ul><li><p>COOLEST GUIDES ON THE PLANETCOOLEST GUIDES ON THE PLANETNeil GeeNeil Gee</p><p>How to compress and uncompress filesand folders in OSX 10.10 Yosemite usingTerminalMarch 19, 2014 15 Comments</p><p>Search the planet... </p><p>HOME OS X WORDPRESS WEBDEV SEO IOS</p><p>ALL POSTS CONTACT</p><p>Compress les &amp; folder in Terminal Command Lin... http://coolestguidesontheplanet.com/how-to-comp...</p><p>1 of 12 30/04/2015 10:02</p></li><li><p> zip-tar-dmg-osx-compress-formats[/caption]</p><p>Since OSX is based on Unix there are a of ways to compress files and folders, below are afew options using the command line interface. The default command line applicationinterface in OSX is the Terminal and stored in /Applications/Utilities.</p><p>We should always compress files and folders to save on file size and ensure the contents arecaptured and delivered or stored as one monolithic file. A compressed file which containsfiles and folders is generally referred to as an archive.</p><p>ZIP Cross PlatformFirst up is ZIP one of the most commonly used compression techniques used across allplatforms</p><p>To compress</p><p>zip -r archive_name.zip folder_to_compress</p><p>Compress les &amp; folder in Terminal Command Lin... http://coolestguidesontheplanet.com/how-to-comp...</p><p>2 of 12 30/04/2015 10:02</p></li><li><p>To extract</p><p>unzip archive_name.zip</p><p>If you want to make a zip without those invisible Mac resource files such as _MACOSX or._Filename and .ds store files, use the -X option in the command so:</p><p>zip -r -X archive_name.zip folder_to_compress</p><p>TAR.GZ Cross PlatformSecond up is TAR, an old favourite on Unix/Linux you add the GZ for the compression compresses tighter than zip</p><p>To compress</p><p>tar -zcvf archive_name.tar.gz folder_to_compress</p><p>To extract</p><p>tar -zxvf archive_name.tar.gz</p><p>TAR.BZ2 Cross PlatformA variation on TAR GZ but with better compression than both tar.gz and zip.</p><p>To compress</p><p>Compress les &amp; folder in Terminal Command Lin... http://coolestguidesontheplanet.com/how-to-comp...</p><p>3 of 12 30/04/2015 10:02</p></li><li><p>tar -jcvf archive_name.tar.bz2 folder_to_compress</p><p>To extract</p><p>tar -jxvf archive_name.tar.bz2</p><p>GZWithout the tar</p><p>To extract</p><p>gunzip archivename.gz</p><p>DMG OSX OnlyThis one is Mac OSX native only for a GUI interface use /Applications/Utilities/Disk Utility for command line use:</p><p>To create</p><p>hdiutil create -format UDZO -srcfolder folder_to_compress archive_name.dmg</p><p>To mount</p><p>hdiutil attach archive_name.dmg</p><p>Compress les &amp; folder in Terminal Command Lin... http://coolestguidesontheplanet.com/how-to-comp...</p><p>4 of 12 30/04/2015 10:02</p></li><li><p>6LikeLike 4 TweetTweet 8</p><p>To view</p><p>ls -lah /Volumes/archive_name/</p><p>To Eject</p><p>hdiutil eject /Volumes/archive_name/</p><p>You can also use a number of dierent formats for creating a .dmg</p><p>UDZO Compressed image (default)UDRO Read only imageUDBZ Better compressed imageUDRW Read/Write imageUDTO DVD disk image</p><p>Related</p><p>Compress les &amp; folder in Terminal Command Lin... http://coolestguidesontheplanet.com/how-to-comp...</p><p>5 of 12 30/04/2015 10:02</p></li><li><p>Cats: OS X, TechTags: compress, OSX, tar, zip</p><p>Compress les &amp; folder in Terminal Command Lin... http://coolestguidesontheplanet.com/how-to-comp...</p><p>6 of 12 30/04/2015 10:02</p></li><li><p>15 Comments Coolest Guides on the Planet Login1Share Sort by Newest</p><p>Join the discussion</p><p> Reply </p><p>Niall Mac Giolla Rua 3 months agoHi. Is creating DMGs better for compression than tar files?</p><p> Reply </p><p>Neil Gee 3 months agoMod &gt; Niall Mac Giolla RuaNo tar is better</p><p> Reply </p><p>Niall Mac Giolla Rua 3 months ago&gt; Neil GeeThank you!</p><p> Reply </p><p>Billy Romano III 5 months agoSo this isn't working in Mac OS X Yosemite. Awesome. Another bug with the new operating system...</p><p>Since Yosemite is a princess, it requires the 'sudo' user command prepended to fix this issue. If not, it will</p><p>throw this error: tar: Failed to open 'archive_name.tar.gz'</p><p>Edit:</p><p>nevermind. It was an issue with the CHOWN of my folder being set to _www, instead of my user</p><p>account... : D</p><p> Reply </p><p>Kourasmenos Tempelaros a year agoIs it possible to split the files also?</p><p>1</p><p> Reply </p><p>Pawe P. a year agoThanks!</p><p> Reply </p><p>dek a year agothis really is a very helpful article. all other guides on the web only explain the .zip way. but tar is a lot</p><p>better.</p><p>Chris M 2 years agoShouldn't tar -jcvf archive_name.tar.bz2 folder_to_compress be :</p><p>tar -jxvf archive_name.tar.bz2 to uncompress?</p><p> Recommend 1</p><p>Share </p><p>Share </p><p>Share </p><p>Share </p><p>Share </p><p>Share </p><p>Share </p><p>Compress les &amp; folder in Terminal Command Lin... http://coolestguidesontheplanet.com/how-to-comp...</p><p>7 of 12 30/04/2015 10:02</p></li><li><p> Subscribe to the</p><p>Latest PostsAdd in your email address...</p><p>Keep Me Posted!</p><p>Find us on Facebook</p><p>Coolest Guides on the Planet</p><p>1,084 people like Coolest Guides on the Planet.</p><p>Facebook social plugin</p><p>LikeLike</p><p>Coolest Guides on the Planet shared alink.</p><p>Like Comment Share</p><p>March 31 at 2:59am</p><p>Overview ofhow JQueryselects HTMLelements on thepage</p><p> | Neil GeeCOOLEST GUIDESCoolestguidesontheplanet.com</p><p>Compress les &amp; folder in Terminal Command Lin... http://coolestguidesontheplanet.com/how-to-comp...</p><p>8 of 12 30/04/2015 10:02</p></li><li><p>Overview of how JQueryselects HTML elementson the page</p><p>March 31, 2015</p><p>Connecting SSH with noPasswords from Localto Live Domain</p><p>March 26, 2015</p><p>LATEST POPULAR COMMENTS</p><p>Overview of how JQuery selects HTMLelements on the page</p><p>Connecting SSH with no Passwords fromLocal to Live Domain</p><p>Install WordPress Dev Sites on Vagrant withVariable VVV</p><p>Using ScrollReveal.js in a WordPress GenesisTheme</p><p>Make a passwordless SSH Connectionbetween OSX 10.10 Yosemite and Linux Server</p><p>Compress les &amp; folder in Terminal Command Lin... http://coolestguidesontheplanet.com/how-to-comp...</p><p>9 of 12 30/04/2015 10:02</p></li><li><p>Install WordPress DevSites on Vagrant withVariable VVV</p><p>January 24, 2015</p><p>Using ScrollReveal.js ina WordPress GenesisTheme</p><p>November 6, 2014</p><p>Make a passwordlessSSH Connectionbetween OSX 10.10Yosemite and LinuxServer</p><p>October 27, 2014</p><p>Turn off AutoCorrect onOSX 10.10 Yosemite forall Applications</p><p>October 21, 2014</p><p>Install and Configurewget on OS X Yosemite10.10 and fix SSL</p><p>GNUTLS errorOctober 20, 2014</p><p>Compress les &amp; folder in Terminal Command Lin... http://coolestguidesontheplanet.com/how-to-comp...</p><p>10 of 12 30/04/2015 10:02</p></li><li><p>Tags</p><p>10.6 apache backup baseband Bing boot CoolestGuy on the Planet Coolest Guy Planet cpanelcss custom database drupal error Firmwaregenesis Google image instadmg iosiphone jailbreak keys Keywords lion mac mysqlOSX PageRank php private Rank Rank Checker rankingredirect rsa SEO SERPS shell ssh terminal Twitterunstoppables WordPress Yahoo</p><p>Compress les &amp; folder in Terminal Command Lin... http://coolestguidesontheplanet.com/how-to-comp...</p><p>11 of 12 30/04/2015 10:02</p></li><li><p>Copyright 2015 Neil Gee - All Rights Reserved! Powered by CGP - Hosted by Servint</p><p>Compress les &amp; folder in Terminal Command Lin... http://coolestguidesontheplanet.com/how-to-comp...</p><p>12 of 12 30/04/2015 10:02</p></li></ul>