A data compression program. Originally a GNU utility it has been cloned by most Unix variants.
Questions tagged [gzip]
376 questions
542
votes
7 answers
Can I zip an entire folder using gzip?
I'm trying to zip a folder in unix.
Can that be done using the gzip command?
user1269502
- 5,521
- 4
- 13
- 4
261
votes
4 answers
How to tell gzip to keep original file?
I would like to compress a text file using gzip command line tool while keeping the original file. By default running the following command
gzip file.txt
results in modifying this file and renaming it file.txt.gz. instead of this behavior I would…
Manuel Selva
- 3,454
- 7
- 20
- 17
248
votes
2 answers
Unzipping a .gz file without removing the gzipped file
I have a file file.gz, when I try to unzip this file by using gunzip file.gz, it unzipped the file but only contains extracted and removes the file.gz file.
How can I unzip by keeping both unzipped file and zipped file?
jack
- 3,853
- 11
- 28
- 33
238
votes
4 answers
Why are tar archive formats switching to xz compression to replace bzip2 and what about gzip?
More and more tar archives use the xz format based on LZMA2 for compression instead of the traditional bzip2(bz2) compression. In fact kernel.org made a late "Good-bye bzip2" announcement, 27th Dec. 2013, indicating kernel sources would from this…
user44370
215
votes
9 answers
tar: Removing leading `/' from member names
root@server # tar fcz bkup.tar.gz /home/foo/
tar: Removing leading `/' from member names
How can I solve this problem and keep the / on file names ?
superuser
- 2,251
- 2
- 13
- 6
206
votes
1 answer
How do you extract a single folder from a large tar.gz archive?
I am using this command on a 5GB archive
tar -zxvf archive.tar.gz /folder/in/archive
is this the correct way to do this? It seems to be taking forever with no command line output...
Garrett Hall
- 5,121
- 5
- 19
- 12
188
votes
14 answers
How to uncompress zlib data in UNIX?
I have created zlib-compressed data in Python, like this:
import zlib
s = '...'
z = zlib.compress(s)
with open('/tmp/data', 'w') as f:
f.write(z)
(or one-liner in shell: echo -n '...' | python2 -c 'import sys,zlib;…
mykhal
- 3,061
- 2
- 18
- 16
115
votes
5 answers
How to add/update a file to an existing tar.gz archive?
Is there a way to add/update a file in a tar.gz archive? Basically, I have an archive which contains a file at /data/data/com.myapp.backup/./files/settings.txt and I'd like to pull that file from the archive (already done) and push it back into the…
Naftuli Kay
- 38,686
- 85
- 220
- 311
95
votes
9 answers
Is there a tool that combines zcat and cat transparently?
When handling log files, some end up as gzipped files thanks to logrotate and others not. So when you try something like this:
$ zcat *
you end up with a command line like zcat xyz.log xyz.log.1 xyz.log.2.gz xyz.log.3.gz and then with:
gzip:…
0xC0000022L
- 16,189
- 24
- 102
- 168
41
votes
7 answers
tar extraction depends on filename?
I often download tarballs with wget from sourceforge.net.
The downloaded files then are named, e.g SQliteManager-1.2.4.tar.gz?r=http:%2F%2Fsourceforge.net%2Fprojects%2Fsqlitemanager%2Ffiles%2F&ts=1305711521&use_mirror=switch
When I try to
tar xzf…
casper
- 413
- 1
- 4
- 4
39
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
- 969
- 4
- 13
- 19
38
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,341
- 9
- 30
- 40
34
votes
4 answers
GZip doesn't produce the same compressed result on macOS vs Linux
I have a few thousand files that are individually GZip compressed (passing of course the -n flag so the output is deterministic). They then go into a Git repository. I just discovered that for 3 of these files, Gzip doesn't produce the same output…
Pol
- 442
- 4
- 6
33
votes
1 answer
Will tar -cvzf packed.tar.gz mydir take hidden files into account?
I need to create a tarball of a given directory. However, I need to make sure hidden files are included too (such as those beginning with .).
Will the following command automatically take the hidden files into account?
tar -cvzf packed.tar.gz…
Jérôme Verstrynge
- 1,699
- 5
- 19
- 20
33
votes
2 answers
Why does the gzip version of files produce a different md5 checksum
I have four files that I created using an svndump
test.svn
test2.svn
test.svn.gz
test2.svn.gz
now when I run this
md5sum test2.svn test.svn test.svn.gz test2.svn.gz
Here is the output
89fc1d097345b0255825286d9b4d64c3 …
whoami
- 3,750
- 7
- 27
- 26