Medha Cloud Logo

How to compress files in CentOS?

In this post, we will see how to compress files in CentOS using terminal commands bzip and gzip2. CentOS is a Community Enterprise operating system which mainly focuses on the server. It is a part of Linux Operating System Distribution, and it is free to use. First, open the terminal. The difference between these commands is that bzip is quick, and bzip2 compresses files to a smaller size

Total Time Needed: 30 Minutes

Required Tools:

CentOS

Steps to compress files in CentOS

Step 1 : To Compress a File Using gzip
Use the command gzip filename to compress a file. For example to compress a file named million.txt type gzip million.txt and press enter.

Step 2 : To Compress Multiple Files Using gzip
Use the same command as above but type all the files to be compressed after gzip. For example, To compress files million2.txt, million3.txt type the command gzip million2.txt million3.txt and press enter.

Step 3 : To Uncompress Files Using gzip
Use the command gunzip followed by file name to unzip the file. For example, to unzip a file million2.txt.gz type the command gunzip million2.txt.gz and press enter.

Step 4: To Compress a File Using bzip2
Use the command bzip2 filename to compress a file. For example to compress a file named million3new.txt type bzip2 million3new.txt and press enter

Step 5: To Compress Multiple Files Using gzip
Use the same command as above but type all the files to be compressed after bzip2. For example, To compress files million.txt, million2.txt type the command bzip2 million.txt million2.txt and press enter.

Step 6: To Uncompress Files Using bzip2
Use the command bunzip2 followed by file name to unzip the file. For example, to unzip a file million2.txt.bz2 type the command bunzip2 million2.txt.bz2 and press enter.

Conclusion:
Following these steps you can compress files in CentOS. If you have any doubts and need support to manage your Linux infrastructure contact Medha Hosting. Our Linux experts will help you 24/7.
Read Here:How to create Files in CentOS?

Connect with Medha Cloud

Microsoft 365 Migration Form

I would like to send my contact information to MedhaCloud so that MedhaCloud can share additional information about products, services, thought leadership and invitations to flagship events with me by email. *

By submitting this form, I acknowledge that someone from MedhaCloud will contact me via email or phone to discuss my request.

Related Article

View All
chevron-down linkedin facebook pinterest youtube rss twitter instagram facebook-blank rss-blank linkedin-blank pinterest youtube twitter instagram