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.




  • 0 Users Found This Useful

Was this answer helpful?

Related Articles

How to install Codeignetor centos 7?

Codeignetor is a PHP framework used to build a web application that is used widely by the...

How to Upgrade PHP Version in cPanel/WHM Server?

Following article will assist you to upgrade PHP version in cPanel/WHM server. This article is...

How to install Mongodb in CentOS?

MongoDB is a Free and open-source cross-platform document-oriented database program. Classified...

How to install the Zabbix agent version 4.0 on Debian 9 (strech)?

Zabbix is an Open-source monitoring tool use to monitor the health of servers, networks and other...

How to List All Files Ordered by Size in Linux?

In Linux, we can list all the files using the ls command. Here, we will share some commands which...