In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-28 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/02 Report--
7-Zip is a file archiver that supports 7z (it implements the LZMA compression algorithm with a very high compression ratio), LZMA2, XZ, ZIP, Zip64, CAB, ARJ, GZIP, BZIP2, TAR, CPIO, RPM, ISO, most file system images and DEB format. The RAR format has been deleted because it is not a free license. Environment Centos7.7 Minimalp7zip-16.02 installation
The default Centos7 does not install the p7zip installation package, and the default source does not have this installation package, so you need to install the Epel source to install the p7zip installation package.
[root@localhost ~] # yum-y install epel-release [root@localhost ~] # yum-y install p7zip p7zip-plugins usage
The 7z command provides function letters similar to the command line option, but does not use -. These parameter letters tell the command which functions it needs to execute.
Compressed file
Create a compressed package using the a parameter
Create a compressed package in 7z format:
[root@localhost] # 7z a files.7z file1.txt file2.txt file3.txt file4.txt 7-Zip [64] 16.02: Copyright (c) 1999-2016 Igor Pavlov: 2016-05-21p7zip Version 16.02 (locale=en_US.UTF-8,Utf16=on,HugeFiles=on,64 bits,1 CPU Intel (R) Core (TM) i5-8400 CPU @ 2.80GHz (906EA), ASM,AES-NI) Scanning the drive:4 files 0 bytesCreating archive: files.7zItems to compress: 4 Files read from disk: 0Archive size: 143 bytes (1 KiB) Everything is Ok
After executing the command, check to see if you have created a compressed package in 7z format
Create a zip file that contains directories:
[root@localhost] # 7z a gpg.7z. Gnupg/7-Zip [64] 16.02: Copyright (c) 1999-2016 Igor Pavlov: 2016-05-21p7zip Version 16.02 (locale=en_US.UTF-8,Utf16=on,HugeFiles=on,64 bits,1 CPU Intel (R) Core (TM) i5-8400 CPU @ 2.80GHz (906EA), ASM,AES-NI) Scanning the drive:2 folders, 5 files 8280 bytes (9 KiB) Creating archive: gpg.7zItems to compress: 7 Files read from disk: 2Archive size: 4157 bytes (5 KiB) Everything is Ok [root@localhost ~] #
7zip can also compress and extract compressed packages in other formats. For example: create a zip file in .zip format.
[root@localhost] # 7z a files.zip file {1.. 4}. Txt7-Zip [64] 16.02: Copyright (c) 1999-2016 Igor Pavlov: 2016-05-21p7zip Version 16.02 (locale=en_US.UTF-8,Utf16=on,HugeFiles=on,64 bits,1 CPU Intel (R) Core (TM) i5-8400 CPU @ 2.80GHz (906EA), ASM,AES-NI) Scanning the drive:4 files, 0 bytesCreating archive: files.zipItems to compress: 4 Files read from disk: 4Archive size: 542bytes (1 KiB) Everything is Ok
List the contents of the compressed package
List the contents of the package using the l parameter:
[root@localhost] # 7z l gpg.7z 7-Zip [64] 16.02: Copyright (c) 1999-2016 Igor Pavlov: 2016-05-21p7zip Version 16.02 (locale=en_US.UTF-8,Utf16=on,HugeFiles=on,64 bits,1 CPU Intel (R) Core (TM) i5-8400 CPU @ 2.80GHz (906EA), ASM,AES-NI) Scanning the drive for archives:1 file 4157 bytes (5 KiB) Listing archive: gpg.7z--Path = gpg.7zType = 7zPhysical Size = 4157Headers Size = 278Method = LZMA2:12kSolid = + Blocks = 1 Date Time Attr Size Compressed Name-- -2020-01-04 18:24:05 D. 0 .gnupg 2020-01-04 18:22:36 D. 0 .gnupg / private-keys-v1.d2020-01-04 18:24:48.... A 00.gnupg-01-04 18:22:36.... A 00.gnupg / pubring.gpg2020-01-04 18:24:05.... A 00.gnupg / secring.gpg2020- 01-04 18:22:36.... A 7680 3879 .gnupg / gpg.conf2020-01-04 18:24:52.... A 600.gnupg / random_seed-- -2020-01-04 18:24:52 8280 3879 5 files 2 folders
Extract the file
Use e to extract files and extract all files to the current directory. (not recommended)
[root@localhost test] # 7z e gpg.7z 7-Zip [64] 16.02: Copyright (c) 1999-2016 Igor Pavlov: 2016-05-21p7zip Version 16.02 (locale=en_US.UTF-8,Utf16=on,HugeFiles=on,64 bits,1 CPU Intel (R) Core (TM) i5-8400 CPU @ 2.80GHz (906EA), ASM,AES-NI) Scanning the drive for archives:1 file 4157 bytes (5 KiB) Extracting archive: gpg.7z--Path = gpg.7zType = 7zPhysical Size = 4157Headers Size = 278Method = LZMA2:12kSolid = + Blocks = 1Everything is OkFolders: 2Files: 5Size: 8280Compressed: 4157
You can see that all the files are unzipped to the current directory.
Now use the x parameter to extract the file and take a look.
[root@localhost test] # 7z x gpg.7z 7-Zip [64] 16.02: Copyright (c) 1999-2016 Igor Pavlov: 2016-05-21p7zip Version 16.02 (locale=en_US.UTF-8,Utf16=on,HugeFiles=on,64 bits,1 CPU Intel (R) Core (TM) i5-8400 CPU @ 2.80GHz (906EA), ASM,AES-NI) Scanning the drive for archives:1 file 4157 bytes (5 KiB) Extracting archive: gpg.7z--Path = gpg.7zType = 7zPhysical Size = 4157Headers Size = 278Method = LZMA2:12kSolid = + Blocks = 1Everything is OkFolders: 2Files: 5Size: 8280Compressed: 4157
You can see that the extracted file is extracted according to the directory form of the original file.
Update compressed package
After a while, you need to add some new files to the folder, and you want to add them to the package, so you don't have to create a new package, you just need to update the existing package.
First compress the test directory
[root@localhost test] # 7z a files.7z test/7-Zip [64] 16.02: Copyright (c) 1999-2016 Igor Pavlov: 2016-05-21p7zip Version 16.02 (locale=en_US.UTF-8,Utf16=on,HugeFiles=on,64 bits,1 CPU Intel (R) Core (TM) i5-8400 CPU @ 2.80GHz (906EA), ASM,AES-NI) Scanning the drive:1 folder, 4 files, 0 bytesCreating archive: files.7zItems to compress: 5 Files read from disk: 0Archive size: 158bytes (1 KiB) Everything is Ok
Create a few files in the test folder, and then update the archive:
[root@localhost test] # touch test/file {5.. 10} .txt [root@localhost test] # 7z u files.7z test/7-Zip [64] 16.02: Copyright (c) 1999-2016 Igor Pavlov: 2016-05-21p7zip Version 16.02 (locale=en_US.UTF-8,Utf16=on,HugeFiles=on,64 bits,1 CPU Intel (R) Core (TM) i5-8400 CPU @ 2.80GHz (906EA), ASM AES-NI) Open archive: files.7z--Path = files.7zType = 7zPhysical Size = 158Headers Size = 158Solid =-Blocks = 0Scanning the drive:1 folder, 10 files, 0 bytesUpdating archive: files.7zItems to compress: 7 Files read from disk: 0Archive size: 186bytes (1 KiB) Everything is Ok
Check to see if files have been added.
[root@localhost test] # 7z l files.7z 7-Zip [64] 16.02: Copyright (c) 1999-2016 Igor Pavlov: 2016-05-21p7zip Version 16.02 (locale=en_US.UTF-8,Utf16=on,HugeFiles=on,64 bits,1 CPU Intel (R) Core (TM) i5-8400 CPU @ 2.80GHz (906EA), ASM,AES-NI) Scanning the drive for archives:1 file 186bytes (1 KiB) Listing archive: files.7z--Path = files.7zType = 7zPhysical Size = 186Headers Size = 186Solid =-Blocks = 0 Date Time Attr Size Compressed Name-- -2020-03-11 14:24:54 D. 0 test2020-03-11 14:18:22.... A 00 test/file1.txt2020-03-11 14:24:54.... A 00 test/file10.txt2020-03-11 14:18:22.... A 00 test/file2.txt2020-03-11 14:18:22.... A 0 test/file3.txt2020-03-11 14:18:22.... A 00 test/file4.txt2020-03-11 14:24:54.... A 00 test/file5.txt2020-03-11 14:24:54.... A 00 test/file6.txt2020-03-11 14:24:54.... A 0 test/file7.txt2020-03-11 14:24:54.... A 00 test/file8.txt2020-03-11 14:24:54.... A 00 test/file9.txt -2020-03-11 14:24:54 0 0 10 files 1 folders
Summary
The compression ratio of 7z format is 30% 50% higher than that of ZIP format.
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.