Unix / Linux: Gunzip and Keep Original Files Unchanged

Objective: Gunzip, by default will delete the .gz file after decompression. Learn how to retain the original files after extracting the .gz file.

The first method to keep the original .gz files is to use the -c option of gunzip. The -c option will write the decompressed data to stdout and will not remove the original .gz file. To extract the file foo.gz to foo while keeping the foo.gz file, use the following syntax.

The output of gunzip is redirected to the decompressed file called foo.

The other method is to use zcat instead of gunzip -c.

If the gzcat utility is not available on your system, try using zcat instead.

ibrahim = { interested_in(unix, linux, android, open_source, reverse_engineering); coding(c, shell, php, python, java, javascript, nodejs, react); plays_on(xbox, ps4); linux_desktop_user(true); }