In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/01 Report--
This article mainly introduces the "compression and decompression command under Linux". In the daily operation, I believe that many people have doubts about the compression and decompression command under Linux. The editor consulted all kinds of data and sorted out a simple and easy-to-use method of operation. I hope it will be helpful to answer the doubts of "compression and decompression command under Linux". Next, please follow the editor to study!
Detailed explanation of tar Compression and decompression Command under Linux
Tar
-c: create compressed files
-x: decompression
-t: view content
-r: appends files to the end of the compressed archive file
-u: update the files in the original package
These five are independent commands, one of which should be used for compression and decompression, which can be used with other commands, but only one of them can be used. The following parameters are optional when compressing or decompressing files as needed.
-z: with gzip attribute
-j: with bz2 attribute
-Z: with compress attribute
-v: show all processes
-O: unlock files to standard output
The following parameter-f is required
-f: use the file name and remember that this parameter is the last parameter and can only be followed by the file name.
# tar-cf all.tar * .jpg
This command is to type all .jpg files into a package called all.tar. -c means 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 to add files.
# tar-uf all.tar logo.gif
This command updates the logo.gif file in the original tar package all.tar, and-u means to update the file.
# tar-tf all.tar
This command lists all the files in the all.tar package.-t means to list files.
# tar-xf all.tar
This command is to unlock all the files in the all.tar package,-t means to unlock
Compress
Tar-cvf jpg.tar * .jpg / / package all jpg files in the directory into tar.jpg
Tar-czf jpg.tar.gz * .jpg / / package all the jpg files in the directory into jpg.tar and compress them with gzip to generate a gzip compressed package named jpg.tar.gz
Tar-cjf jpg.tar.bz2 * .jpg / / package all the jpg files in the directory into jpg.tar and compress them with bzip2 to generate a bzip2 compressed package named jpg.tar.bz2
Tar-cZf jpg.tar.Z * .jpg / / package all the jpg files in the directory into jpg.tar and compress them with compress to generate a umcompress compressed package named jpg.tar.Z
For rar a jpg.rar * .jpg / / rar format, you need to download rar for linux first.
For compression in zip jpg.zip * .jpg / / zip format, you need to download zip for linux first
Decompression
Tar-xvf file.tar / / extract the tar package
Tar-xzvf file.tar.gz / / decompress tar.gz
Tar-xjvf file.tar.bz2 / / decompress tar.bz2
Tar-xZvf file.tar.Z / / decompress tar.Z
Unrar e file.rar / / decompress rar
Unzip file.zip / / decompress zip
Summary
1. Tar is decompressed with tar-xvf
2. *. Gz is decompressed with gzip-d or gunzip
3. * .tar.gz and * .tgz are decompressed with tar-xzf
4. * .bz2 decompress with bzip2-d or bunzip2
5. * .tar.bz2 decompress with tar-xjf
6. * .Z decompress with uncompress
7. Tar.Z is decompressed with tar-xZf
8. *. Rar decompressed with unrar e
9. *. Zip decompressed with unzip
At this point, the study of "compression and decompression commands under Linux" 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.