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

How to install and use 7-Zip in Centos7

2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

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

This article introduces the relevant knowledge of "how to install and use 7-Zip in Centos7". In the operation of actual cases, many people will encounter such a dilemma, so let the editor lead you to learn how to deal with these situations. I hope you can read it carefully and be able to achieve something!

7-Zip (7z decompression software) is a completely free compression and decompression software, compared with other compression software, its compression speed is faster and the compression ratio is better. It not only supports many mainstream formats and hyperthreading, but also has a powerful AES-256 encryption algorithm for file encryption to enhance file security.

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.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.7zItems to compress: 4 Files read from disk: 0Archive size: 143bytes (1 KiB) Everything is Ok

After executing the command, check to see if you have created a compressed package in 7z format to create a compressed package containing 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.7z7-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.7z7-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.7z7-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.7z7-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 "how to install and use 7-Zip in Centos7" ends here. Thank you for your reading. If you want to know more about the industry, you can follow the website, the editor will output more high-quality practical articles for you!

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

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report