main logo

Reduce file size: Learn to compress files in CentOS

Reduce File Size: Learn 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?

Rakshitha
Rakshitha
Rakshitha a cloud hosting expert who helps businesses get the most out of their cloud services. She has experience setting up and managing cloud environments to improve performance and scalability. With her cloud certification, Rakshitha provides clear advice on how to use cloud solutions effectively for better business results.
Share
Contents

Related Articles

medhacloud logo
USA:
Medha Cloud Solutions LLC
30 N Gould St Ste R, Sheridan, WY 82801,
Phone: +1 646 775 2855

India:
Medha Cloud Solutions Private Limited
#74, 7th Cross, Krishna Garden InCity Layout. Chikka Kammanahalli, Banneraghatta Road, Bangalore 560083
Phone:+91 93536 44646

E-Mail: sales@medhahosting.com
©Medha Cloud 2024. All rights reserved.