.gz is a compressed file created with Gzip. To extract files created with Gzip is straight-forward in Linux, but in order to extract the contents to another folder is little bit trickier. In Linux terminal, type:
$ gunzip -c your-file.txt.gz > folder/your-file.txt
-c tells the gunzip to output the contents to the standard output and to keep original file unchanged. Then we direct the output (decompressed content) to the target file
folder/your-file.txt. Note, that the target folder must exists.