Zip vs Tar.gz Files Explained and Compared (Archiving and the DEFLATE algorithm)

Tony Tascioglu (TechnoTony) May 16, 2022
Video Thumbnail

Tony Tascioglu (TechnoTony)

View Channel

About

No channel description available.

Video Description

In this video, I explain the similarities and differences between two popular compressed archive formats, zip on Windows, and tar.gz in the *nix world. Both formats typically use the same compression, and also serve as a way to collect files together in an archive, however, there are a some fundamental differences between how they work and why they're used for different purposes. I discuss the two main steps of compression and linearizing the files into an archive, and how each stage differs between the two formats, as well as the advantages and disadvantages of each implementation. I hope you enjoy the video and learn something new! This is yet another video that is a bit rambly at times (having cut it down from over 30 minutes). I have added timestamps so you can easily skip between the sections you're interested in. I apologize in advance for the clipped (and heavily compressed) audio, this was recorded accidentally with a 10 dB boost on the mic, on a 128K MP3 recorder making for a questionable combination. ## Timestamps ### Introduction 00:00 - Introduction 00:19 - What is a zip and tar file? 01:45 - Gzip (and other compressors) 02:45 - Why use tar instead of zip on Linux? ### What's the difference? 03:48 - How does tar work? 04:39 - How does zip work? ### Comparison 05:09 - The advantages of zip 06:46 - The advantage of tar.gz (and streaming compression) 08:30 - The disadvantage of tar ### Further learning 09:30 - Notes on 7zip and .gz.tar 10:40 - Indexed tar files with pixz (and comparison to 7z) 13:30 - What should you use? 15:10 - Conclusion ## Links (Get Smarter Section) DEFLATE algorithm: Wiki: https://en.wikipedia.org/wiki/Deflate How DEFLATE works (good summary): https://zlib.net/feldspar.html Full specification: https://datatracker.ietf.org/doc/html/rfc1951 TAR format: Wiki: https://en.wikipedia.org/wiki/Tar_(computing) Man page: https://linux.die.net/man/1/tar Tar format specs: https://www.gnu.org/software/tar/manual/html_node/Standard.html Gzip: (based on DEFLATE) Wiki: https://en.wikipedia.org/wiki/Gzip Homepage: https://www.gnu.org/software/gzip/ Bzip2: Wiki: https://en.wikipedia.org/wiki/Bzip2 Homepage: https://www.sourceware.org/bzip2/ XZ utils: (LZMA2 compression) Wiki: https://en.wikipedia.org/wiki/XZ_Utils Homepage: https://tukaani.org/xz/ pixz: (parallel indexed xz) https://github.com/vasi/pixz pigz: (parallel implementation of gz) https://github.com/madler/pigz Lzip: (also based on LZMA2) Homepage: https://www.nongnu.org/lzip/ LZMA2 Compression: Wiki: https://en.wikipedia.org/wiki/Lempel%E2%80%93Ziv%E2%80%93Markov_chain_algorithm Z-Standard Compression: (aka zstd) Wiki: https://en.wikipedia.org/wiki/Zstd Homepage: https://facebook.github.io/zstd/ Source: https://github.com/facebook/zstd 7zip: (also generally LZMA) Wiki: https://en.wikipedia.org/wiki/7-Zip Homepage: https://www.7-zip.org/ Source code: https://sourceforge.net/projects/sevenzip/ p7zip (POSIX port): http://p7zip.sourceforge.net/ Zip: (generally DEFLATE) Wiki: https://en.wikipedia.org/wiki/ZIP_(file_format) Specs: https://pkware.cachefly.net/webdocs/casestudies/APPNOTE.TXT Dar: (competing new format for tar) http://dar.linux.free.fr/ ## Content used: Zip and Tar icons in thumbnail from FlatIcon. Ending music is We'll Meet Again by TheFatRat ## Clarifications and Corrections Just to clarify a few things before I get some comments: The 'only decompress the file' benefit I mentioned in zip is because zip (and 7z) keep an index at the front. If you did .gz.tar, you wouldn't get that benefit, as tar isn't indexed. Next, when I say 'the index of the tar file is at the end', what I mean is that if you want the file list (like an index would produce), you need to read the archive to the end as though there is an index there (tar files don't have an index, just a few bytes at the front of each file). So, to get a file list, you need to read those bytes at the start of each file, meaning you have to read the full archive. I hope this clarifies it. Clarification: pigz is not indexed, pixz is. Pixz is backwards compatible with xz, although both support multithreading these days. (more to be added)

You May Also Like

DIY Lava Lamp Necessities

AI-recommended products based on this video

Loading...
Wellova DMSO 99.9% Pharmaceutical Grade with 99.9% Purity & Low Odor - 4oz (Dimethyl Sulfoxide) Clear Glass Bottle with Dropper

Wellova DMSO 99.9% Pharmaceutical Grade with 99.9% Purity & Low Odor - 4oz (Dimethyl Sulfoxide) Clear Glass Bottle with Dropper

(82)
$21.93
FREE delivery Sat, Aug 16 on your first order
500+ bought in past month
Loading...
[3 Pack] UniqueMe Screen Protector Compatible for Samsung Galaxy S25 Ultra Tempered Glass HD Clear Screen Protector with Easy Installation Frame, 9H Hardness Anti Scratch Bubble Free

[3 Pack] UniqueMe Screen Protector Compatible for Samsung Galaxy S25 Ultra Tempered Glass HD Clear Screen Protector with Easy Installation Frame, 9H Hardness Anti Scratch Bubble Free

(0)
$10.43
FREE delivery Sat, Jun 14 on your first order
500+ bought in past month
Loading...
[2-Pack] Lmcpa Screen Protector for Nintendo New Switch 2(2025)7.9 Inch, Anti-Scratch, Bubble-Free, Transparent HD Clear Tempered Glass Film Screen Protector, 9H Hardness, Ultra-Thin 0.25mm, Accessories for Switch 2

[2-Pack] Lmcpa Screen Protector for Nintendo New Switch 2(2025)7.9 Inch, Anti-Scratch, Bubble-Free, Transparent HD Clear Tempered Glass Film Screen Protector, 9H Hardness, Ultra-Thin 0.25mm, Accessories for Switch 2

(242)
$9.99
FREE delivery Wed, Jul 2 on your first order
1K+ bought in past month
Loading...
JETech Full Coverage Screen Protector for iPhone 16e 2025, iPhone 14 6.1-Inch, 9H Tempered Glass Film Case-Friendly, HD Clear, 3-Pack

JETech Full Coverage Screen Protector for iPhone 16e 2025, iPhone 14 6.1-Inch, 9H Tempered Glass Film Case-Friendly, HD Clear, 3-Pack

(7,597)
$8.99
FREE delivery Wed, Aug 20 on your first order
5K+ bought in past month
Loading...
Spigen Case for iPhone 16 Plus Case, Liquid Crystal Glitter Designed for Apple iPhone 16 Plus - Crystal Quartz

Spigen Case for iPhone 16 Plus Case, Liquid Crystal Glitter Designed for Apple iPhone 16 Plus - Crystal Quartz

(760)
$18.99
FREE delivery Sat, Jun 14 on your first order
Loading...
LITTLEFUN Decorate Your Own Baseball Cap with Glitter Gem Stickers for Kids Crafts Toys Gifts - Girls Birthday Presents

LITTLEFUN Decorate Your Own Baseball Cap with Glitter Gem Stickers for Kids Crafts Toys Gifts - Girls Birthday Presents

(56)
$28.99
FREE delivery Sat, Jun 14 on your first order
300+ bought in past month
Loading...
Furiet for Samsung Galaxy S24/S25 5G Floral Wallet Case with Flip Zipper Purse Wrist Strap Shoulder Strap Luxury Glitter PU Leather Card Holder Stand Phone Cover for S 24 24S 25 25S G5 Women Purple

Furiet for Samsung Galaxy S24/S25 5G Floral Wallet Case with Flip Zipper Purse Wrist Strap Shoulder Strap Luxury Glitter PU Leather Card Holder Stand Phone Cover for S 24 24S 25 25S G5 Women Purple

(0)
$58.59$58.31
FREE delivery Jun 13 - 17 Only 6 left in stock.
Loading...
Generic Jelly Shoes for Girls, Kid Fishermen Sandals, Princess Birthday Toddler Glitter Sandal Summer Beach Shoe Footwear

Generic Jelly Shoes for Girls, Kid Fishermen Sandals, Princess Birthday Toddler Glitter Sandal Summer Beach Shoe Footwear

(0)
$17.97
FREE delivery Jun 17 - 26
Loading...
HATALKIN Case Compatible with Apple AirTags Case Keychain Air tag Holder Air Tag Key Ring Cases Air Tags Protective Cover Airtag Key Chain Loop Holders Silicone for Luggage Dog Cat Pet Collar 4 Pack

HATALKIN Case Compatible with Apple AirTags Case Keychain Air tag Holder Air Tag Key Ring Cases Air Tags Protective Cover Airtag Key Chain Loop Holders Silicone for Luggage Dog Cat Pet Collar 4 Pack

(19,279)
$9.78
FREE delivery Mon, Aug 25 on your first order
1K+ bought in past month
Loading...
Silicone Scar Cream Gel for Scars: Medical Grade Silicone for Old and New Scars

Silicone Scar Cream Gel for Scars: Medical Grade Silicone for Old and New Scars

(47)
$21.99$21.15
FREE delivery Sun, Aug 10 on your first order
800+ bought in past month
Loading...
L00KLY Kids Case for Lenovo Tab M11 2024 With Screen Protector, Built-in Kickstand and Handle - Lightweight Shockproof Silicone for 11 Inch Tablet (TB330FU) Blue

L00KLY Kids Case for Lenovo Tab M11 2024 With Screen Protector, Built-in Kickstand and Handle - Lightweight Shockproof Silicone for 11 Inch Tablet (TB330FU) Blue

(17)
$22.39
FREE delivery Tue, Jun 17 on your first order
Loading...
Anti Snoring Devices for Quiet Sleep: Adjustable Mouth Guard for Sleep - Silicone Snore Stopper for Men Women Home & Travel Use (1 Pack)

Anti Snoring Devices for Quiet Sleep: Adjustable Mouth Guard for Sleep - Silicone Snore Stopper for Men Women Home & Travel Use (1 Pack)

(73)
$31.49
FREE delivery Sun, Oct 19 on your first order
1K+ bought in past month
Loading...
High Accuracy and LCD Digital Clear Display Non-Contact Photoelectric Velocimeter Mini RPM Tester Meter for Motor, Wheels, Lathe, Electrical Fan, Paper Making, Plastic Industry, Washing Machines

High Accuracy and LCD Digital Clear Display Non-Contact Photoelectric Velocimeter Mini RPM Tester Meter for Motor, Wheels, Lathe, Electrical Fan, Paper Making, Plastic Industry, Washing Machines

(0)
$13.53
FREE delivery Sun, Aug 10 on your first order
Loading...
MBLABEL 350 Bags/Roll - 30x50cm(12x20in) Clear Plastic Bags for Groceries, Transparent Produce Bag for Fruits Vegetable Kitchen Food Storage, Small Reusable Poly Packing Bags

MBLABEL 350 Bags/Roll - 30x50cm(12x20in) Clear Plastic Bags for Groceries, Transparent Produce Bag for Fruits Vegetable Kitchen Food Storage, Small Reusable Poly Packing Bags

(127)
$49.98
PrimeFREE delivery Sat, Jun 14
Loading...
KMEOSCH Rubber Earring Backs For Studs, KMEOSCH Hypoallergenic Soft Plastic Pierce Clear Silicone Secure Earring Backs For Posts Fish Hook Wire Earrings (12Pcs Gold)

KMEOSCH Rubber Earring Backs For Studs, KMEOSCH Hypoallergenic Soft Plastic Pierce Clear Silicone Secure Earring Backs For Posts Fish Hook Wire Earrings (12Pcs Gold)

(245)
$7.98
FREE delivery Sat, Jun 14 on your first order
Loading...
EooCoo Compatible with MacBook Air 15 inch Case 2025 2024 2023 Release M4 A3241 M3 A3114 M2 A2941 Liquid Retina Display, Plastic Hard Shell Case + Keyboard Cover + Screen Protector, Crystal Clear Global Recycled Standard

EooCoo Compatible with MacBook Air 15 inch Case 2025 2024 2023 Release M4 A3241 M3 A3114 M2 A2941 Liquid Retina Display, Plastic Hard Shell Case + Keyboard Cover + Screen Protector, Crystal Clear Global Recycled Standard

(1,903)
$22.95
FREE delivery Sat, Jun 14 on your first order
100+ bought in past month
Loading...
Paint Your Own Moon Lamp Kit, DIY 3D Moon Night Light with Space Figurines & Wooden Stand, Art Supplies Creativity Arts & Crafts Kit for Kids, Toys Girls Boy Birthday Easter Gift Ages 3 4 5 6 7 8 9 10 11 12+

Paint Your Own Moon Lamp Kit, DIY 3D Moon Night Light with Space Figurines & Wooden Stand, Art Supplies Creativity Arts & Crafts Kit for Kids, Toys Girls Boy Birthday Easter Gift Ages 3 4 5 6 7 8 9 10 11 12+

(2,309)
$19.99
FREE delivery Sat, Jun 14 on your first order
400+ bought in past month
Loading...
Windshield Repair kit, DIY Glass Cracked Repair Kits, Easy to Use Automotive Glass Nano Repair Fluid, Scratch Chip Cracks Repair Kit (2 Pack) (Black)

Windshield Repair kit, DIY Glass Cracked Repair Kits, Easy to Use Automotive Glass Nano Repair Fluid, Scratch Chip Cracks Repair Kit (2 Pack) (Black)

(41)
$8.18
Prime
800+ bought in past month
Loading...
Windshield Crack Repair kit Windshield Repair kit, Glass Repair kit, DIY Glass Cracked Repair Kits, Easy to Use Automotive Glass Nano Repair Fluid, Scratch Chip Cracks Repair Kit 2 Pack (Drakgray)
Best Seller

Windshield Crack Repair kit Windshield Repair kit, Glass Repair kit, DIY Glass Cracked Repair Kits, Easy to Use Automotive Glass Nano Repair Fluid, Scratch Chip Cracks Repair Kit 2 Pack (Drakgray)

(44)
$9.20
FREE delivery Fri, Oct 24 on your first order
500+ bought in past month
Loading...
LEGO Icons French Café Paris Building Kit - DIY Set for Adults - Collectible Bedroom and Home Decor - Display for Home or Office - Gift for Coffee Lovers - 10362

LEGO Icons French Café Paris Building Kit - DIY Set for Adults - Collectible Bedroom and Home Decor - Display for Home or Office - Gift for Coffee Lovers - 10362

(24)
$79.98
PrimeFREE delivery Sat, Jun 14
100+ bought in past month