How to use gzip in Linux?

Linux has many commands line tools to compress/decompress files and gzip is one of them. In this article, we will show you the basics of gzip and how to use it with some examples.

Example - 1 Compress file with gzip

You can use the below command to compress the file with gzip.

gzip [file-name]	

You can see now in the below images that we have used gzip command to compress file samplefile.txt and it is compressed now in samplefile.txt.gz

zip file

file zipped

Example - 2 How to uncompress the file using gzip

You can use the below command to uncompress the file with gzip. Use the -d syntex to do it.

gzip -d [compressed-file-name]	

You can see now in the below images, We have uncompressed the file samplefile.txt.gz. And the compressed file was deleted.

uncompress

unzipped

 

Related Articles

How to Install LEMP Stack (Nginx, MariaDB, PHP7.2) on Ubuntu 18.04 LTS?

Nginx, MariaDB and PHP7.2 are called (LEMP). Following are the steps to install LEMP on Ubuntu...

How to Install a Perl Module in cPanel?

Perl module allows adding the custom functionality to cPanel & WHM server. Please refer to...

The action Install for product MySQL Server 5.7.19 failed.

You may face this error while installing MySQL 5.7 or upgrading MySQL 5.6 to 5.7. Here, is the...

How to Switch Web Server from Apache to LiteSpeed on WHM?

Apache and LiteSpeed both are the WebServers. Apache is older and popular compared to LiteSpeed....

How to add IP address in Ubuntu using command?

Sometimes you may require to add the IP Address manually in ubuntu network Interface. Following...

  • 0 Users Found This Useful

Was this answer helpful?