Uncompress txt.gz files

25,519

unzip is for .zip files not for .gz. Try first

file abc.txt.gz

This will tell you, if it is a .gz, .zip, .bz or any other file. You can then choose the appropriate program.

Share:
25,519

Related videos on Youtube

Shraddha
Author by

Shraddha

Updated on September 18, 2022

Comments

  • Shraddha
    Shraddha almost 2 years

    Trying to uncompress txt.gz files on Linux. gzip, gunzip, unzip are not recognizing the file format. The archive is guaranteed to be not corrupted.

    • clerksx
      clerksx over 11 years
      What is the error? If it is truly not corrupted and is a gzip file, gzip -d will do it.
    • angus
      angus over 11 years
      What does file txt.gz say?
    • Shraddha
      Shraddha over 11 years
      $ file file.txt.gz file.txt.gz: data
    • Shraddha
      Shraddha over 11 years
      $ gzip -d file.txt.gz gzip: file.txt.gz: not in gzip format
    • angus
      angus over 11 years
      Either the files are already uncompressed and contain data or text in an encoding file doesn't recognize (try it: rename one to file.txt and open it in an editor), or you should talk with whoever guaranteed you they aren't corrupted.
    • cheshirecatalyst
      cheshirecatalyst over 11 years
      Add the output of hd file.txt.gz | head - 8 to your question and we will be able to answer.
  • Shraddha
    Shraddha over 11 years
    see my comments ^^^^^
  • Olaf Dietsche
    Olaf Dietsche over 11 years
    Then your file seems to be arbitrary data or at least not any known compressed format.