In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-10 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/01 Report--
This article mainly introduces the "introduction of compression and decompression parameters of files under the Linux platform". In daily operation, I believe that many people have doubts about the introduction of compression and decompression parameters of files under the Linux platform. The editor consulted all kinds of data and sorted out simple and easy-to-use methods of operation. I hope it will be helpful to answer the doubts of "introduction of compression and decompression parameters of files under the Linux platform". Next, please follow the editor to study!
Faced with some suffixes tar, tar.gz, tar.bz2. I was a little confused.
As a matter of fact, if you understand it, it will be easily solved.
First of all, let's make it clear that packaging and compression under linux are two different things.
That is, you can package the file, but not compress it.
Let's look at an example:
In my root directory, there is a folder called wallpaper, which contains some wallpaper
I am now packing this folder, but not compressing it.
Enter tar cvf wallpaper.tar wallpaper directly and enter to generate a wallpaper package.
The operation process is shown in the following figure:
The tar here is a packaging command, and the following cvf is a parameter
C means to create a package file (if replaced by x, it means unpacking), and v displays the file during compression
F is to use the file name, then add the name of the package you want to generate, and then add the compressed directory.
Now we've learned to pack, and then we compress it:
Enter gzip wallpaper.tar to generate a compressed package of walllpaper.tar.gz.
Gzip here is a compression command, is it necessary to choose tar to package, and then use gzip to compress
In fact, it is not so troublesome, as long as add the parameter z after tar to have the function of gzip, in other words, just use:
The command tar zcvf wallpaper.tar.gz wallpaper can generate the wallpaper.tar.gz file directly.
The process is as follows:
This is the way to build a compressed package. Files compressed with different programs will have different suffixes.
For example, the suffix of the file compressed with compress is * .z, and the file compressed with bzip2 is * .bz2
Using zip to compress is * .zip and so on, the most common of which is * .tar.bz2. And * .tar.gz (also known as Tarball files)
As in the example above, if we package it with bzip2 wallpaper.tar, the resulting file is wallpaper.tar.bz2.
The specific command parameters can be viewed with command-help.
After the compressed package is established, the next step is to decompress. As in the example above, we now decompress the wallpaper.tar.gz.
There are two ways:
1. First decompress the compressed package with gzip plus parameter d, and then unpack it with tar plus parameter x. As shown in the figure:
2. Use tar plus parameters z and xvf to decompress and unpack directly. Z here actually adds the function of gzip.
This is also the most commonly used method. Similarly, if it is a file with the suffix * .tar.bz2, just replace z with j.
As mentioned earlier, tar has integrated the functions of gzip and bzip2, just add different parameters to them.
So adding J here indicates that tar has the function of bzip2.
We know that under windows we can double-click the archive file to see what's inside without unlocking it.
We can also do this under linux, as long as we add the parameter t after tar to view the contents of the package.
But it didn't unlock it.
For example, if we check what is in wallpaper.tar.gz, we can enter:
Another thing I would like to say is that the suffix name of the compressed package actually has no practical meaning, so don't be confused by the suffix name.
For example, if we package and compress the wallpaper folder, it can be written as follows:
The generated wallpaper.songzi is also a compressed file. Let's look at this with file.
At this point, the study on the "introduction of file compression and decompression parameters under the Linux platform" is over. I hope to be able to solve your doubts. The collocation of theory and practice can better help you learn, go and try it! If you want to continue to learn more related knowledge, please continue to follow the website, the editor will continue to work hard to bring you more practical articles!
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.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.