How to unzip .gz file using Google Colab?

Viewed 3213

I downloaded the English FastText embedding file with the .gz extension. When I intended to unzip it using Google Colab, I get the following error:

Archive:  /content/drive/My Drive/New_ABCDM_Architec/cc.en.300.vec.gz End-of-central-directory signature not found.  Either this file is not a zipfile, or it constitutes one disk of a multi-part archive.  In the latter case the central directory and zipfile comment will be found on the last disk(s) of this archive.
unzip:  cannot find zipfile directory in one of /content/drive/My Drive/New_ABCDM_Architec/cc.en.300.vec.gz or /content/drive/My Drive/New_ABCDM_Architec/cc.en.300.vec.gz.zip, and cannot find /content/drive/My Drive/New_ABCDM_Architec/cc.en.300.vec.gz.ZIP, period
\n!unzip  '/content/drive/My Drive/New_ABCDM_Architec/cc.fr.300.vec.gz'\n!unzip  '/content/drive/My Drive/New_ABCDM_Architec/cc.ar.300.vec.gz'\n

I understand that to use !unzip the file should have a .zip extension. My question is, how to unzip .gz files?

1 Answers
!tar -xzvf "/content/drive/path/file_name.tar.gz" "/content/drive/path/destination_directory"

 

Flags

  • -x : Extract
  • -c : Create a new archive
  • -v : Verbose output
  • -f : Use the given archive file (name.extention)
  • -z : Filter the archive through gzip
  • -j : Filter the archive through bzip2
Related