您好,登錄后才能下訂單哦!
本篇內容介紹了“Centos7中怎么安裝并使用7-Zip”的有關知識,在實際案例的操作過程中,不少人都會遇到這樣的困境,接下來就讓小編帶領大家學習一下如何處理這些情況吧!希望大家仔細閱讀,能夠學有所成!
7-Zip(7z解壓軟件)是一款完全免費的壓縮解壓縮軟件,同其他壓縮軟件相比它的壓縮速度更快壓縮率更好,不僅支持眾多主流格式、支持超線程,而且還有強大的AES-256加密算法可以為文件進行加密,增強文件的安全性。
默認Centos7沒有安裝p7zip安裝包,默認源里面也沒有這個安裝包,需要安裝epel源才能安裝p7zip安裝包。
[root@localhost ~]# yum -y install epel-release[root@localhost ~]# yum -y install p7zip p7zip-plugins
7z命令提供的函數字母與命令行選項類似,但使用時不使用-。這些參數字母告訴命令它需要執行的函數。
創建一個壓縮包使用a參數
創建一個7z格式的壓縮包:
[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-21 p7zip 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 bytes Creating archive: files.7z Items to compress: 4 Files read from disk: 0 Archive size: 143 bytes (1 KiB) Everything is Ok
執行完命令,查看一下是否已經創建7z格式的壓縮包 創建一個包含目錄的壓縮包:
[root@localhost ~]# 7z a gpg.7z .gnupg/7-Zip [64] 16.02 : Copyright (c) 1999-2016 Igor Pavlov : 2016-05-21 p7zip 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.7z Items to compress: 7 Files read from disk: 2 Archive size: 4157 bytes (5 KiB) Everything is Ok [root@localhost ~]#
7zip還可以壓縮、解壓縮其他格式的壓縮包。比如:創建一個.zip格式的壓縮包。
[root@localhost ~]# 7z a files.zip file{1..4}.txt7-Zip [64] 16.02 : Copyright (c) 1999-2016 Igor Pavlov : 2016-05-21 p7zip 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 bytes Creating archive: files.zip Items to compress: 4 Files read from disk: 4 Archive size: 542 bytes (1 KiB) Everything is Ok
列出壓縮包里面的內容
列出壓縮包的內容使用l參數:
[root@localhost ~]# 7z l gpg.7z7-Zip [64] 16.02 : Copyright (c) 1999-2016 Igor Pavlov : 2016-05-21 p7zip 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.7z Type = 7z Physical Size = 4157 Headers Size = 278 Method = LZMA2:12k Solid = + Blocks = 1 Date Time Attr Size Compressed Name ------------------- ----- ------------ ------------ ------------------------ 2020-01-04 18:24:05 D.... 0 0 .gnupg 2020-01-04 18:22:36 D.... 0 0 .gnupg/private-keys-v1.d 2020-01-04 18:24:48 ....A 0 0 .gnupg/S.gpg-agent 2020-01-04 18:22:36 ....A 0 0 .gnupg/pubring.gpg 2020-01-04 18:24:05 ....A 0 0 .gnupg/secring.gpg 2020-01-04 18:22:36 ....A 7680 3879 .gnupg/gpg.conf 2020-01-04 18:24:52 ....A 600 .gnupg/random_seed ------------------- ----- ------------ ------------ ------------------------ 2020-01-04 18:24:52 8280 3879 5 files, 2 folders
解壓文件
使用e來解壓文件,解壓所有文件到當前目錄。(不推薦使用)
[root@localhost test]# 7z e gpg.7z7-Zip [64] 16.02 : Copyright (c) 1999-2016 Igor Pavlov : 2016-05-21 p7zip 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.7z Type = 7z Physical Size = 4157 Headers Size = 278 Method = LZMA2:12k Solid = + Blocks = 1 Everything is Ok Folders: 2 Files: 5 Size: 8280 Compressed: 4157
可以看到所有文件都解壓到當前目錄了。 現在使用x參數解壓文件看一下。
[root@localhost test]# 7z x gpg.7z7-Zip [64] 16.02 : Copyright (c) 1999-2016 Igor Pavlov : 2016-05-21 p7zip 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.7z Type = 7z Physical Size = 4157 Headers Size = 278 Method = LZMA2:12k Solid = + Blocks = 1 Everything is Ok Folders: 2 Files: 5 Size: 8280 Compressed: 4157
可以看到解壓出來的文件,按照原來文件的目錄形式解壓出來的。
更新壓縮包
一段時間之后,需要將一些新文件添加到文件夾中,并且希望將他們添加到壓縮包里面,可以不用創建一個新的壓縮包,只需要更新現有的壓縮包就可以。
首先將test目錄壓縮
[root@localhost test]# 7z a files.7z test/7-Zip [64] 16.02 : Copyright (c) 1999-2016 Igor Pavlov : 2016-05-21 p7zip 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 bytes Creating archive: files.7z Items to compress: 5 Files read from disk: 0 Archive size: 158 bytes (1 KiB) Everything is Ok
在test文件夾中創建幾個文件,然后再更新壓縮包:
[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-21 p7zip 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.7z Type = 7z Physical Size = 158 Headers Size = 158 Solid = - Blocks = 0 Scanning the drive: 1 folder, 10 files, 0 bytes Updating archive: files.7z Items to compress: 7 Files read from disk: 0 Archive size: 186 bytes (1 KiB) Everything is Ok
查看一下是否已經添加文件。
[root@localhost test]# 7z l files.7z7-Zip [64] 16.02 : Copyright (c) 1999-2016 Igor Pavlov : 2016-05-21 p7zip 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, 186 bytes (1 KiB) Listing archive: files.7z -- Path = files.7z Type = 7z Physical Size = 186 Headers Size = 186 Solid = - Blocks = 0 Date Time Attr Size Compressed Name ------------------- ----- ------------ ------------ ------------------------ 2020-03-11 14:24:54 D.... 0 0 test2020-03-11 14:18:22 ....A 0 0 test/file1.txt 2020-03-11 14:24:54 ....A 0 0 test/file10.txt 2020-03-11 14:18:22 ....A 0 0 test/file2.txt 2020-03-11 14:18:22 ....A 0 0 test/file3.txt 2020-03-11 14:18:22 ....A 0 0 test/file4.txt 2020-03-11 14:24:54 ....A 0 0 test/file5.txt 2020-03-11 14:24:54 ....A 0 0 test/file6.txt 2020-03-11 14:24:54 ....A 0 0 test/file7.txt 2020-03-11 14:24:54 ....A 0 0 test/file8.txt 2020-03-11 14:24:54 ....A 0 0 test/file9.txt ------------------- ----- ------------ ------------ ------------------------ 2020-03-11 14:24:54 0 0 10 files, 1 folders
“Centos7中怎么安裝并使用7-Zip”的內容就介紹到這里了,感謝大家的閱讀。如果想了解更多行業相關的知識可以關注億速云網站,小編將為大家輸出更多高質量的實用文章!
免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。