`gzip` (or GNU zip) is a file format and corresponding utility for compressing files using the DEFLATE algorithm. The usual extension is `.gz`.

learn more… | top users | synonyms

50
votes
2answers
2k views

Why is piping 'dd' through gzip so much faster than a direct copy?

I wanted to backup a path from a computer in my network to another computer in the same network over a 100 Mbit/s line. For this I did dd if=/local/path ...
41
votes
4answers
47k views

How to password protect gzip files on the command line?

I want to create some tar.gz (and possibly tar.bz2) files, using the tar command on Ubuntu 10.04. I want to password protect the file. What is the command to do this (I have Googled, but found ...
40
votes
4answers
40k views

How to specify level of compression when using tar -zcvf?

I gzip directories very often at work. What I normally do is tar -zcvf file.tar.gz /path/to/directory Is there a way to specify the compression level here? I want to use the best compression ...
35
votes
5answers
21k views

Pros and cons of bzip vs gzip?

I've known gzip for years, recently I saw bzip being used at work. Are they basically equivalent, or are there significant pros and cons to one of them over the other?
28
votes
4answers
5k views

gzip without tar? Why are they used together?

Why are tar and gzip almost always used together, and not just gzip? Is there any advantage to that method?
22
votes
5answers
1k views

Why doesn't Gzip compression eliminate duplicate chunks of data?

I just did a little experiment where I created a tar archive with duplicate files to see if it would be compressed, to my awe, it was not! Details follow (results indented for reading pleasure): $ dd ...
22
votes
6answers
2k views

How can I evaluate the best choice of archive format for compressing files?

In general, I've observed the following: Linux-y files or tools use bzip2 or gzip for distributing archives Windows-y files or tools use ZIP for distributing archives Many people use 7-Zip for ...
21
votes
7answers
37k views

tar: Exiting with failure status due to previous errors

I have written a little script that tars and compresses a list of directories + files. The script appears to run succesfully, in that a useable .tar.gz file is created after the script runs. ...
20
votes
5answers
33k views

What is the maximum compression ratio of gzip?

What is the largest size a gzip (say 10kb for the sake of an example) can be decompressed to?
19
votes
4answers
49k views

How to gzip multiple files into one gz file?

I have 100 files: cvd1.txt cvd2.txt ... cvd100.txt How to gzip 100 files into one .gz file so that after I gunzip it, I should have cvd1.txt, cvd2.txt ... cvd100.txt separately? Thanks for your ...
14
votes
5answers
39k views

Command to 'gzip' a folder?

I am new to Mac command prompt stuff. How do you create a gzip of a folder in Mac OS X? I was told by a few folks that if you want to create a gzip of a folder you should 'tar' it first and then ...
14
votes
3answers
11k views

How to know if a site is gzipped?

I am accessing some web sites which are really really slow, and I would like to know if those sites are gzipped. Is there an easy way to find this out?
13
votes
4answers
5k views

Rsync friendly gzip

I must not be the only one - I'm rsyncing .tar.gz files and notice that every time the full file gets rsynced rather than the differences. Reading into it it seems back in 1999 someone created an ...
12
votes
5answers
7k views

SVN directly to tar

Is there a way to directly tar the latest version of an SVN folder without the SVN hidden files? I would like to create a tar archive without the SVN files. I know you can get the latest with the SVN ...
12
votes
5answers
5k views

Fastest GZIP utility

I'm looking for the fastest gzip (or zip) utility. I have a LVM volume which 95% exists out of blank 0's, so compressing that is very easy. I'm looking for the most fastest solution, and don't really ...
10
votes
3answers
1k views

Files with same content but with different md5sums when gzip'd?

I don't know why this is happening, but I upload some files to Amazon S3 then delete the sent files checking their md5sum both in Amazon and locally. But recently I found this issue about the same ...
9
votes
6answers
17k views

How do I uncompress vmlinuz to vmlinux?

I have already tried uncompress, gzip, and all other solutions that come up as google results and these have not worked for me. To get just the image search for the GZ signature - 1f 8b 08 00. ...
9
votes
4answers
9k views

How to obtain maximum compression with .tar.gz?

The way i understand the use of tar + gzip is that tar is normally used to consolidate a grouping of files into a single file, then gzip is used to compress that file. I recently learned that tar can ...
8
votes
1answer
12k views

How to list the contents of a zip along w/ file sizes and compression ratio via cmd line

How do I list the contents of a zip along w/ file sizes and compression ratio (or packed size) on osx w/ command line tools?
8
votes
4answers
6k views

gzip all files without deleting them

I need to gzip all files in a dir separately including all files in sub-directories without deleting the originals afterwards. So let's say I have index.html, I want to have at the end index.html.gzip ...
8
votes
3answers
3k views

Is there a way to mount a file.tar.bz2 without extracting it onto the filesystem?

Is there a way to mount a file.tar.bz2 without extracting it onto the filesystem? I don't care if the mount is read only. Hopefully your answer will also apply to file.tar.gz. "mount" in this ...
7
votes
1answer
6k views

When using “gzip --decompress”, the result is “gzip: MYFILE.zip: unknown suffix — ignored” on Windows

In Windows PowerShell (if it matters), I would like to decompress a zip file with gzip with the argument --decompress, but unfortunately it doesn't work. Please look at the screenshot below. gzip ...
7
votes
2answers
17k views

Howto pipe: cp | tar | gzip without creating intermediary files?

Can anyone tell me if it's possible to pipe | this without having to create a physical file anywhere between A and B.tar.gz? This is what I'm trying to do: File A Rename A to B Tar B.tar gzip -9 ...
6
votes
3answers
4k views

How to gzip a directory, transfer via scp, and decompress in one command?

I frequently transfer large directories over scp and it would be sweet if I could somehow compress the directory, send it, and decompress it all in one. Is something like this possible?
6
votes
7answers
706 views

Moving files in a local network - would compressing improve speed?

I am moving some 20Gb within my local network (100 Mbit/sec). The files are from a typical Linux desktop system. Would compressing them using Tar\Gzip and then sending them improve performance? ...
6
votes
4answers
550 views

Tar and gzip together, but the other way round?

Gzipping a tar file as whole is drop dead easy and even implemented as option inside tar. So far, so good. However, from an archiver's point of view, it would be better to tar the gzipped single ...
6
votes
4answers
3k views

Which archiving method is better for compressing text files on Linux?

In my application I need do compress of logs that are text files. Seems that bzip2 and gzip have the same compression ratio. Is that correct?
6
votes
4answers
16k views

Unexpected end of file. Gzip compressed file

I am going crazy with a gzip file. I can decompress the file in Windows using WinRAR but it is impossible on any UNIX operating system. the file seems to be ok. If I do file the_name_of_the_file.gz ...
5
votes
2answers
6k views

What is the fastest compression method for a large number of files?

I need to compress a directory with around 350,000 fairly small files that amount to about 100GB total. I am using OSX and am currently using the standard "Compress" tool that converts this directory ...
4
votes
2answers
917 views

Tell if a .gz file is really gzipped

What is a nice command-line trick to tell if a .gz file is really gzipped, as opposed to being a non-Gzip file just named that way?
4
votes
3answers
35k views

How do I gunzip a directory?

I have a gzipped directory called "new" which contains other directories and files, that I compressed in the following way gzip -cvr --no-name /path-to-directory/new > new.gz I have copied this ...
4
votes
1answer
1k views

Does Linux GZip Zip the File in Place or create a new file

I have a 1.5TB size text file that I need to gzip down, the current drive it is on has little to no space left. I have another drive with 400G left on it. My question is, if I gzip the file, will it ...
4
votes
2answers
3k views

Time to zip very large (100G) files

I find myself having to compress a number of very large files (80-ish GB), and I am surprised at the (lack of) speed my system is exhibiting. I get about 500 MB / min conversion speed; using top, I ...
4
votes
2answers
3k views

Is there a way to force gzip not to overwrite files on conflict?

I'm writing a script in which I'm gzipping files. There's a possibility that I might zip a file, create a file of the same name, and try to gzip this as well, e.g. $ ls -l archive/ total 4 ...
4
votes
2answers
4k views

Bash command to compress folder(s) with a password

How can I compress two folders into archive file (zip, gzip or something like that) with a password on the files? For example I have folder structure: rootDir dir1 dir2 dir3 dir4 I need bash ...
4
votes
1answer
1k views

Why is gzip slow despite CPU and hard drive performance not being maxed out?

I have some JSON files, 20 GB each, that I want to compress with gzip: gzip file1.json This takes up one full CPU core, all fine. It processes around 25 MB/s (checked in atop), my hard drive can ...
4
votes
1answer
518 views

Decompressing these .gz files gives strange/unexpected results, can you get it working?

I have a collection of mailing list archive files all gzip'd, they're in a nested directory structure that starts with what appears to be a blank folder/jargon name. The files are here: ...
3
votes
1answer
7k views

What can be used to 'gzip' in Windows?

gzipped files are awesome! they are the best compressed files I know, .rar and .zip are nowhere near , if you compare the compression ratios... Generally I use Windows, does anyone know how can I ...
3
votes
6answers
3k views

Converting gzip files to bzip2 efficiently

I have a bunch of gzip files that I have to convert to bzip2 every now and then. Currently, I'm using a shell script that simply 'gunzip's each file and then 'bzip2's it. Though this works, it takes a ...
3
votes
2answers
6k views

How to GZIP all the files or a list of files from some path?

I know that gzip compress a file, but I would want to know. How to compress a list of files, each file in their own GZIP file ? I need to use the list of a folder: ls log.2011 And for each file ...
3
votes
1answer
55 views

Why does tar with -z option create archive with different hash everytime

Can you tell me why tar czf archive.tar dir creates archive with different hash everytime (I check with 'md5sum') Without compression parameter -z or with parameter -j instead all works fine. ...
3
votes
1answer
2k views

Critical gzip mistake (HELP!) - how to undo 'gzip -r ./'

So I was hoping to make a gzipped backup of my entire directory stucture, but I was very stupid and issued the command 'gzip -r ./' hoping to add all files and folders to a single gzip archive. This ...
3
votes
2answers
181 views

What type of data is compressed more effectively by bzip2 than gzip/zlib?

I'm comparing compression functions, and I'm surprised by what I'm seing. Maybe I'm doing something wrong, but everything I've tested has been more compressed by gzip than bzip2! I was under the ...
3
votes
1answer
511 views

Google Chrome Developer Tools data transfer size

In Google Chrome when using the Network Panel to monitor files being transfered from a site, the total size of the data transfered is given at the bottom of the list. Does this figure reflect the size ...
3
votes
1answer
1k views

How can I get the uncompressed size of gzip file without actually decompressing it?

Please find my OS details: $ uname -a AIX xxyy 1 6 000145364C00 I've tried the following command to get size of a file in gzip archive: $ gzip -l mycontent.DAT.Gz compressed uncompr. ratio ...
2
votes
4answers
454 views

Why are there binary differences among compressed files generated exactly the same way from the exact same starting file?

I use the "diff" command to compare two compressed files generated using zip on the exact same starting file and they are reported as being different. However, when I uncompress them and use the ...
2
votes
3answers
2k views

gzip change file ownership

Here is a case i don't understand i have a group 'bar', and this group has two users; 'foo' and 'bar'. I have a test.txt file, 'foo' is the owner and 'bar' user only can read it. However, if 'bar' ...
2
votes
1answer
1k views

gzip - Extracting without deleting zip file

Right now I am running an extract from a .gz file using the Windows gzip.exe. However when I decompress the file, it kills the .gz file and leaves me with the extract file. For example if I run this ...
2
votes
1answer
173 views

UNIX shell command to expand files of any compressed type

Is there any UNIX shell command to expand a compressed file which type is not known in advance? I should be able to use this command to expand at least any of the following types of files, though the ...
2
votes
2answers
4k views

.tgz file- tar: Unrecognized archive format

I'm trying to install a 10gen build of mongodb on my local mac running Mountain Lion (10.8.3): I fetch it with curl at: curl http://downloads.mongodb.org/osx/mongodb-osx-x86_64-2.4.tgz > ...