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

Do you have any limits for setting up Cron jobs or schedule tasks?

Windows Shared Hosting Plans:We do not offer cron jobs in Windows shared hosting plans. Linux...

How to remove Swap Space from Centos 7.x?

Please refer to the following steps to remove Swap space from Centos 7.x At first, check if...

How to sync time using NTP in Ubuntu server?

Linux server users might have noticed that after adjusting the system clock to the correct time,...

How to Enable Extended Logging in Exim?

Extended Exim log is helpful in troubleshooting Exim issues on Linux Server. It allows you to add...

How to create users and groups in CentOS7?

Once the Linux system is configured, adding and removing users is one of the most basic tasks...

  • 0 Users Found This Useful

Was this answer helpful?