Upload
lebink312
View
272
Download
0
Tags:
Embed Size (px)
DESCRIPTION
How to compress files and folders from the terminal
Citation preview
COOLEST GUIDES ON THE PLANETCOOLEST GUIDES ON THE PLANETNeil GeeNeil Gee
How to compress and uncompress filesand folders in OSX 10.10 Yosemite usingTerminalMarch 19, 2014 15 Comments
Search the planet...
HOME OS X WORDPRESS WEBDEV SEO IOS
ALL POSTS CONTACT
Compress les & folder in Terminal Command Lin... http://coolestguidesontheplanet.com/how-to-comp...
1 of 12 30/04/2015 10:02
zip-tar-dmg-osx-compress-formats[/caption]
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.
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.
ZIP Cross PlatformFirst up is ZIP one of the most commonly used compression techniques used across allplatforms
To compress
zip -r archive_name.zip folder_to_compress
Compress les & folder in Terminal Command Lin... http://coolestguidesontheplanet.com/how-to-comp...
2 of 12 30/04/2015 10:02
To extract
unzip archive_name.zip
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:
zip -r -X archive_name.zip folder_to_compress
TAR.GZ Cross PlatformSecond up is TAR, an old favourite on Unix/Linux you add the GZ for the compression compresses tighter than zip
To compress
tar -zcvf archive_name.tar.gz folder_to_compress
To extract
tar -zxvf archive_name.tar.gz
TAR.BZ2 Cross PlatformA variation on TAR GZ but with better compression than both tar.gz and zip.
To compress
Compress les & folder in Terminal Command Lin... http://coolestguidesontheplanet.com/how-to-comp...
3 of 12 30/04/2015 10:02
tar -jcvf archive_name.tar.bz2 folder_to_compress
To extract
tar -jxvf archive_name.tar.bz2
GZWithout the tar
To extract
gunzip archivename.gz
DMG OSX OnlyThis one is Mac OSX native only for a GUI interface use /Applications/Utilities/Disk Utility for command line use:
To create
hdiutil create -format UDZO -srcfolder folder_to_compress archive_name.dmg
To mount
hdiutil attach archive_name.dmg
Compress les & folder in Terminal Command Lin... http://coolestguidesontheplanet.com/how-to-comp...
4 of 12 30/04/2015 10:02
6LikeLike 4 TweetTweet 8
To view
ls -lah /Volumes/archive_name/
To Eject
hdiutil eject /Volumes/archive_name/
You can also use a number of dierent formats for creating a .dmg
UDZO Compressed image (default)UDRO Read only imageUDBZ Better compressed imageUDRW Read/Write imageUDTO DVD disk image
Related
Compress les & folder in Terminal Command Lin... http://coolestguidesontheplanet.com/how-to-comp...
5 of 12 30/04/2015 10:02
Cats: OS X, TechTags: compress, OSX, tar, zip
Compress les & folder in Terminal Command Lin... http://coolestguidesontheplanet.com/how-to-comp...
6 of 12 30/04/2015 10:02
15 Comments Coolest Guides on the Planet Login1Share Sort by Newest
Join the discussion
Reply
Niall Mac Giolla Rua 3 months agoHi. Is creating DMGs better for compression than tar files?
Reply
Neil Gee 3 months agoMod > Niall Mac Giolla RuaNo tar is better
Reply
Niall Mac Giolla Rua 3 months ago> Neil GeeThank you!
Reply
Billy Romano III 5 months agoSo this isn't working in Mac OS X Yosemite. Awesome. Another bug with the new operating system...
Since Yosemite is a princess, it requires the 'sudo' user command prepended to fix this issue. If not, it will
throw this error: tar: Failed to open 'archive_name.tar.gz'
Edit:
nevermind. It was an issue with the CHOWN of my folder being set to _www, instead of my user
account... : D
Reply
Kourasmenos Tempelaros a year agoIs it possible to split the files also?
1
Reply
Pawe P. a year agoThanks!
Reply
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
better.
Chris M 2 years agoShouldn't tar -jcvf archive_name.tar.bz2 folder_to_compress be :
tar -jxvf archive_name.tar.bz2 to uncompress?
Recommend 1
Share
Share
Share
Share
Share
Share
Share
Compress les & folder in Terminal Command Lin... http://coolestguidesontheplanet.com/how-to-comp...
7 of 12 30/04/2015 10:02
Subscribe to the
Latest PostsAdd in your email address...
Keep Me Posted!
Find us on Facebook
Coolest Guides on the Planet
1,084 people like Coolest Guides on the Planet.
Facebook social plugin
LikeLike
Coolest Guides on the Planet shared alink.
Like Comment Share
March 31 at 2:59am
Overview ofhow JQueryselects HTMLelements on thepage
| Neil GeeCOOLEST GUIDESCoolestguidesontheplanet.com
Compress les & folder in Terminal Command Lin... http://coolestguidesontheplanet.com/how-to-comp...
8 of 12 30/04/2015 10:02
Overview of how JQueryselects HTML elementson the page
March 31, 2015
Connecting SSH with noPasswords from Localto Live Domain
March 26, 2015
LATEST POPULAR COMMENTS
Overview of how JQuery selects HTMLelements on the page
Connecting SSH with no Passwords fromLocal to Live Domain
Install WordPress Dev Sites on Vagrant withVariable VVV
Using ScrollReveal.js in a WordPress GenesisTheme
Make a passwordless SSH Connectionbetween OSX 10.10 Yosemite and Linux Server
Compress les & folder in Terminal Command Lin... http://coolestguidesontheplanet.com/how-to-comp...
9 of 12 30/04/2015 10:02
Install WordPress DevSites on Vagrant withVariable VVV
January 24, 2015
Using ScrollReveal.js ina WordPress GenesisTheme
November 6, 2014
Make a passwordlessSSH Connectionbetween OSX 10.10Yosemite and LinuxServer
October 27, 2014
Turn off AutoCorrect onOSX 10.10 Yosemite forall Applications
October 21, 2014
Install and Configurewget on OS X Yosemite10.10 and fix SSL
GNUTLS errorOctober 20, 2014
Compress les & folder in Terminal Command Lin... http://coolestguidesontheplanet.com/how-to-comp...
10 of 12 30/04/2015 10:02
Tags
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
Compress les & folder in Terminal Command Lin... http://coolestguidesontheplanet.com/how-to-comp...
11 of 12 30/04/2015 10:02
Copyright 2015 Neil Gee - All Rights Reserved! Powered by CGP - Hosted by Servint
Compress les & folder in Terminal Command Lin... http://coolestguidesontheplanet.com/how-to-comp...
12 of 12 30/04/2015 10:02