In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/01 Report--
This article introduces the relevant knowledge of "how to decompress files under linux". In the actual case operation process, many people will encounter such difficulties. Next, let Xiaobian lead you to learn how to deal with these situations! I hope you can read carefully and learn something!
For those who are new to Linux, there will definitely be a lot of different file names for Linux. Not to mention, just compressed files for example, we know that the most common compressed files under Windows are only two, one is,zip, and the other is.rap. Linux is different, it has.gz,.tar.gz, tgz, bz2,.Z,.tar and many other compressed file names, in addition to windows.zip and.rar can also be used under Linux, but in Linux use.zip and.rar too few people. This article will summarize these common compressed files, hoping that the next time you encounter these files, you will not be confused icon_smile.gif
Before summarizing all kinds of compressed files, we must first understand two concepts: packaging and compression. Packaging refers to turning a large number of files or directories into a total file, while compression refers to turning a large file into a small file through some compression algorithm. Why distinguish between these two concepts? In fact, many compression programs in Linux can only compress a file, so when you want to compress a lot of files, you have to use another tool to first make a package of this lot of files, and then compress the original compression program.
The most commonly used packaging program under Linux is tar. The package printed by tar program is often called tar package. The command of tar package file usually ends with.tar. After generating the tar package, you can use other programs to compress it, so first let's talk about the basic usage of the tar command:
There are many options for tar command (you can view them with man tar), but there are only a few commonly used options. Here are some examples:
# tar -cf all.tar *.jpg
This command is to group all.jpg files into a package called all.tar. - c is to generate a new package, and-f specifies the file name of the package.
# tar -rf all.tar *.gif
This command adds all.gif files to the all.tar package. - r means adding files.
# tar -uf all.tar logo.gif
This command updates the logo.gif file in the original tar package all.tar. -u means update file.
# tar -tf all.tar
This command lists all files in the all.tar package, -t means list files
# tar -xf all.tar
This command is to extract all files in the all.tar package, -t means to extract.
This is the most basic use of tar. To make it easier for users to compress or decompress files while packing and unpacking, tar provides a special feature. This means that tar can call other compression programs at the same time as packing or unpacking, such as calling gzip, bzip2, etc.
1)tar calls gzip
gzip is a compression program developed by GNU, and the files ending in.gz are the result of gzip compression. The opposite of gzip is gunzip. tar uses the-z argument to invoke gzip. Here are some examples:
# tar -czf all.tar.gz *.jpg
This command is to format all.jpg files into a tarball and gzip them to produce a gzip package called all.tar.gz
# tar -xzf all.tar.gz
This command unpacks the packets generated above.
2)tar calls bzip2
bzip2 is a more powerful compression program, and the file ending in.bz2 is the result of bzip2 compression. The opposite of bzip2 is bunzip2. tar uses the-j argument to invoke gzip. Here are some examples:
# tar -cjf all.tar.bz2 *.jpg
This command is to make all.jpg files into a tarball and compress them with bzip2 to generate a bzip2 compressed package called all.tar.bz2
# tar -xjf all.tar.bz2
This command unpacks the packets generated above.
3)tar calls compress
Compress is also a compression program, but it seems that the use of compress people than gzip and bzip2 more people. The file at the end of Z is the result of bzip2 compression. The opposite of compress is uncompress. tar uses the-Z argument to invoke gzip. Here are some examples:
# tar -cZf all.tar.Z *.jpg
This command is to pack all.jpg files into a tar package and compress them to generate an uncompressed package named all.tar.Z
# tar -xZf all.tar.Z
This command unpacks the packets generated above.
With the above knowledge, you should be able to unpack a variety of compressed files, the following is a summary of tar series compressed files:
1)For files ending in.tar
tar -xf all.tar
2)For files ending in.gz
gzip -d all.gz
gunzip all.gz
3)For files ending in.tgz or.tar.gz
tar -xzf all.tar.gz
tar -xzf all.tgz
4)For files ending in.bz2
bzip2 -d all.bz2
bunzip2 all.bz2
5)For files ending in tar.bz2
tar -xjf all.tar.bz2
6)For files ending in.Z
uncompress all.Z
7)For files ending in.tar.Z
tar -xZf all.tar.z
Linux also has a way to extract the.zip and.rar files that are common under Windows:
1)For.zip
Linux provides zip and unzip programs, zip is a compression program, unzip is a decompression program. There are many parameter options, here is only a brief introduction, still an example of its use:
# zip all.zip *.jpg
This command compresses all.jpg files into a zip package
# unzip all.zip
This command unpacks all the files in all.zip
2)For.rar
To process.rar files under linux, you need to install RAR for Linux, which can be downloaded from the web, but remember, RAR for Linux
Not free; RAR for Linux 3.2.0 can be downloaded from http://www.rarsoft.com/download.htm and installed:
# tar -xzpvf rarlinux-3.2.0.tar.gz
# cd rar
# make
This installation is good, after installation there are rar and unrar these two programs, rar is the compression program, unrar is the decompression program. There are many parameter options, here is only a brief introduction, still an example of its use:
# rar a all *.jpg
This command compresses all.jpg files into a rar package called all.rar, which automatically appends the.rar extension to the package name.
# unrar e all.rar
This command unpacks all the files in all.rar
So far, we have introduced tar, gzip, gunzip, bzip2, bunzip2, compress, uncompress, zip, unzip, rar, unrar, etc. programs under Linux. You should be able to use them to.tar,.gz,.tar.gz,.tgz,.bz2,.tar.bz2,. Z,.tar.Z,.zip,.rar these 10 kinds of compressed files were decompressed, in the future should not need to download a software and do not know how to unlock under Linux and worry about. And the above method is basically valid for Unix.
This article introduces tar, gzip, gunzip, bzip2, bunzip2, compress, uncompress, zip, unzip, rar, unrar and other programs under linux, and how to use them to.tar,.gz,.tar.gz,.tgz,.bz2,.tar.bz2,.Z,. tar.Z,.zip,.rar.
"How to extract files under linux" content is introduced here, thank you for reading. If you want to know more about industry-related knowledge, you can pay attention to the website. Xiaobian will output more high-quality 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.
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.