Compress to and Uncompress a .gz file

From Computing and Software Wiki

Revision as of 20:21, 9 April 2007 by RobertLi (Talk)
(diff) ← Older revision | Current revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Compress to and Uncompress a .gz file

gzip utility will compress a file and create a .gz file:

    gzip File_Name

This will make the file File_Name replaced by a compressed file File_Name.gz. If you want keep the original file while creating a compressed .gz file, use the following command:

    gzip -c File_Name > new_file.gz

To uncompress a .gz or .GZ file, use utility gzip or gunzip:

gzip -d File_Name.gz or gunzip File_Name.gz This will uncompress the file File_Name.gz, create a new file File_Name replacing File_Name.gz.

If for some reasons you want to keep the compressed file, use the following command:

gzip -dc File_Name.gz>File_Name or gunzip -c File_Name.gz>File_Name

Personal tools