How to Use Gzip in Linux?

Linux has many command line tools to compress/ decompress files, and Gzip is one of them. 

This article will show you the basics of Gzip and how to use it with some examples.

Example - 1
Compress the File with Gzip

You can use this command to compress the file with gzip – 

gzip [file-name]   

You can see in the images below that we have used the Gzip command to compress the samplefile.txt file to samplefile.txt.gz.

zip file

file zipped

Example - 2
How to Uncompress the File using Gzip

You can use the command below to uncompress the file with Gzip using the -d syntex.

gzip -d [compressed-file-name]   

You can see in the images depicted below that we have uncompressed the samplefile.txt.gz file, and we deleted the compressed file.




Was this answer helpful?

« Back