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

What are the methods of decompressing files with linux

2025-03-29 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

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

In this issue, the editor will bring you the methods of decompressing linux files. The article is rich in content and analyzes and narrates it from a professional point of view. I hope you can get something after reading this article.

I. zip format

Zip is probably the most widely used document compression format today. Its biggest advantage is that it is used on different operating system platforms. The disadvantage is that the compression ratio supported is not very high, and tar.gz and tar.bz2 do a very good job in compression ratio.

We can compress a file using the following command:

Zip-r archive_name.zip filename (- r is a compressed file)

Here is how to extract a zip file:

Unzip archive_name.zip (extract the file under the current file) unzip archive_name.zip-d new_dir (extract the file to a directory you specify, use the-d parameter)

II. Tar format

Tar is a document packaging format that is widely used in Linux. The advantage is that it consumes very little CPU and time to package files, it is just a packaging tool and is not responsible for compression. Here is how to package a directory:

Tar-cvf archive_name.tar directory_to_compress

The-c parameter is to create a new archive

The-v parameter shows the processed file in detail

The-f parameter specifies the archive or device

How to unpack after packing:

Tar-xvf archive_name.tar

The above unpacking command will unpack the document under the current directory. Of course, you can also use the following command to unpack to the specified path:

Tar-xvf archive_name.tar-C new_dir

The parameter for unpacking is-C, not lowercase c

III. Tar.gz format

This format is the compression format I use most often. It does not take up too much CPU when compressing, and it can get a very ideal compression ratio.

Compression method:

Tar-zcvf archive_name.tar.gz filename

Decompression method:

Tar-zxvf archive_name.tar.gz

The above unpacking command will unpack the document under the current directory. Of course, you can also use the following command to specify the path to unpack:

Tar-zxvf archive_name.tar.gz-C new_dir

IV. Tar.bz2 format

This compression format has the best compression ratio of all the methods we have mentioned. Of course, this means that it takes up more CPU and time than the previous approach.

Compression method:

Tar-jcvf archive_name.tar.bz2 filename

Decompression method:

Tar-jxvf archive_name.tar.bz2

The above unpacking command will unpack the document under the current directory. Of course, you can also use the following command to specify the path to unpack:

Tar-jxvf archive_name.tar.bz2-C new_dir above is the method of decompressing the linux files shared by the editor. If you happen to have similar doubts, you might as well refer to the above analysis to understand. If you want to know more about it, you are welcome to follow the industry information channel.

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