I have a .gz file called document.txt.gz file. It is supposed to be a text file which got compressed to a gzip file. When I uncompress, I am getting a corrupt file.

I ran the following commands:

$ file document.txt.gz

and the result is

document.txt.gz: gzip compressed data, max speed, from FAT filesystem (MS-DOS, OS/2, NT)

and I again ran the file command on the unzipped portion

$ file document.txt.gz

and the result is

document.txt: gzip compressed data, last modified: Mon Mar 12 22:16:42 2018, from Unix

I am unsure why my uncompressed file is still a gzip compressed data.

Is there a way to retrieve the original file?

closed as unclear what you're asking by Kusalananda, Jeff Schaller, thrig, Christopher, n.st Jan 15 at 0:10

Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.

  • 3
    It looks to me that you run file document.txt.gz twice and get two different results. Could you please clarify what you are doing. Also, what does gunzip document.txt.gz say (if it does not create document.txt)? – Kusalananda May 25 '18 at 5:36
  • 4
    Which command do you use to uncompress the file? – dr01 May 25 '18 at 8:27

In your case decompress the file by gzip -d document.txt.gz The -d flag is used to indicate the decompression or uncompression.

Read the man page of gzip for more information.

Good luck!

Not the answer you're looking for? Browse other questions tagged or ask your own question.