A data compression program. Originally a GNU utility it has been cloned by most Unix variants.
Questions tagged [gzip]
378 questions
41
votes
2 answers
Check validity of gz file
How can I check the validity of a gz file, I do not have the hash of the file, I'm using gzip -t but it is not returning any output.

Noor
- 989
39
votes
4 answers
gunzip all .gz files in directory
I have a directory with plenty of .txt.gz files (where the names do not follow a specific pattern.)
What is the simplest way to gunzip them? I want to preserve their original names, so that they go from whatevz.txt.gz to whatevz.txt

The Unfun Cat
- 3,391
20
votes
1 answer
Use gzip to compress the files in a directory except for already existing .gz files
I have a directory of logs that I would like to set up a job to compress using gzip. The issue is I don't want to recompress the logs I've already compressed.
I tried using ls | grep -v gz | gzip, but that doesn't seem to work.
Is there a way to do…

jabbajac
- 305
16
votes
6 answers
How to create a gzip file without .gz file extension?
I would like to create a gzipped file that retains the original file name. For example gzipping "example.txt" should output a gzipped file named "example.txt" rather than "example.txt.gz." Is it possible to do this elegantly with one command (not…

jamieb
- 261
14
votes
3 answers
gzip: unexpected end of file with - how to read file anyway
I have a job on a batch system that runs extremely long and produces tons of output. So much actually that I have to pipe the standard output through gzip to keep the batch node from filling its work area and subsequently crashing.
longscript | gzip…

carsten
- 355
13
votes
1 answer
Why does gzipping a file on stdin yield a smaller output than the same file given as an argument?
When I do:
# gzip -c foo > foo1.gz
# gzip < foo > foo2.gz
Why does foo2.gz end up being smaller in size than foo1.gz?

MichalH
- 2,379
12
votes
2 answers
Splitting gzip-file into smaller gz-files without recompressing
I have a big .gz file. I would like to split it into 100 smaller gzip files, that can each be decompressed by itself. In other words: I am not looking for a way of chopping up the .gz file into chunks that would have to be put back together to be…

Ole Tange
- 35,514
7
votes
3 answers
Decompress gzip file in place
I have a huge file (420 GB) compressed with gzip and I want to decompress it, but my HDD doesn't have space for storing the whole compressed file and its contents.
Would there be a way of decompressing it 'while deleting it'?
In case it helps, gzip…

Noxbru
- 73
5
votes
1 answer
Can gzip -t detect 100% of truncated-download errors?
Scenario: a single 1g CSV.gz is being written to an FTP folder. At the same time, my client machine connects over sFTP to that folder and attempts to pull it down.
Q: After fetching that file, resulting in whatever apparent length I get client-side,…

xander
- 153
4
votes
3 answers
Un-concatenate gzipped file
The other day I was collecting some logs from a remote server and unthinkingly gzipped the files into a single file, rather than adding the directory to a tarball. I can manually separate out some of the log files, but some of them were already…

geminary
- 43
4
votes
1 answer
How to decompress only a portion of a file?
I have a large, repetitive text file. It compresses very well - it's about 3MB compressed. However, if decompressed, it takes 1.7GB. Since it's repetitive, I only need a fraction of the output to check the contents of the file.
It was compressed…

Vitor Py
- 1,912
- 2
- 19
- 24
3
votes
2 answers
Split gz file and decompress individually
I have a big .gz file, which is 2.6 GB in itself. I cannot uncompress it due to size limitation. The file is a single large text file. I am not being able to decompress it completely due to size limitation. I want to split it into say 10 individual…

Noor
- 989
3
votes
1 answer
Append timestamp while zipping a file
I am using the below command to find files which are greater than particular size and zip it. How can I modify the below command to include the timestamp at the end of the file?
find . -type f -name "*querry_match*" -size +550000000c -exec gzip {}…

Chittha Shetty
- 147
2
votes
1 answer
Convert dos line endings in .gz zipped file faster
I have 120 .gz files (each about 5G) with dos line endings, my goal is to convert those to unix line endings, but I don't want to wait multiple days.
Here is my current approach:
function conv() {
tmpfile=$(mktemp .XXXXXX)
zcat $1 >…

Michael M.
- 23
2
votes
2 answers
Extract gzip from data file
I'm looking for some guidance on how to get this gzip out of a data file.
$ file cut6
cut6: data
$ binwalk cut6
DECIMAL HEXADECIMAL DESCRIPTION
.......................................
1 0x1 gzip compressed data, from FAT filesystem…

Ben
- 21