The default behavior of gunzip is to delete the .gz file after it decompresses.
How do I prevent it from deleting the file??
If this functionality is not included then is there an alternative program that allows this?
I'm using Ubuntu 9.04
Super User is a question and answer site for computer enthusiasts and power users. It only takes a minute to sign up.Sign up to join this community
You're looking for:
gzcat x.txt.gz >x.txt
gzcat command is equivalent to
gunzip -c which simply writes the output stream to
stdout. This will leave the compressed file untouched. So you can also use:
gunzip -c x.txt.gz >x.txt
Note that on some systems gzcat is also known as
zcat so run like this instead:
zcat x.txt.gz >x.txt
You can use the
-c option of gunzip which writes the output to stdout, and then pipe it to the file of your choice:
gunzip -c compressed-file.gz > decompressed-file
More details on the manual page.