Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to use Gzip to compress and extract files in Linux

2025-02-23 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/01 Report--

This article mainly introduces "how to use Gzip to compress and decompress files in Linux". In daily operation, I believe many people have doubts about how to use Gzip to compress and decompress files in Linux. Xiaobian consulted various materials and sorted out simple and easy operation methods. I hope to answer your doubts about "how to use Gzip to compress and decompress files in Linux"! Next, please follow the small series to learn together!

Gzip stands for GNU zip, which is a compression application widely used in Linux operating systems. The files compressed by Gzip have the suffix '*. gz'.

The basic usage is as follows:

a) Compressed files

The code is as follows:

gzip file(s)

Each file will be compressed separately.

compressed file

Usually after compression is complete, it deletes the original file. We can use the-c option to keep the original file.

The code is as follows:

gzip -c file > file.gz

Keep the original file after compression

We can also compress a group of files into a single file

The code is as follows:

cat file1 file2 file3 | gzip > archieve.gz

compress a set of files

b) Check compression ratio

The compression ratio of the compressed file can be checked using the '-l' option.

The code is as follows:

gzip -l archieve.gz

Check compression ratio

c) Extract files

Gunzip is used to extract files, where the original (compressed) files are also deleted after extraction. Use the-c option to preserve the original file.

The code is as follows:

gunzip -c archieve.gz

extract the files

Gzip plus the '-d' option has the same effect as gunzip on compressed files.

More details can be found on the gzip homepage.

At this point, on "how to use Gzip in Linux to compress and decompress files" learning is over, hoping to solve everyone's doubts. Theory and practice can better match to help everyone learn, go and try it! If you want to continue learning more relevant knowledge, please continue to pay attention to the website, Xiaobian will continue to strive to bring more practical articles for everyone!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report