成长值: 336 签到天数: 4737 天
[LV.Master]伴坛终老
wget --no-check-certificate https://downloads.sourceforge.net/project/p7zip/p7zip/16.02/p7zip_16.02_src_all.tar.bz2
tar -xjvf p7zip_16.02_src_all.tar.bz2
cd p7zip_16.02
make -j 4
make install
复制代码
看到如下信息就说明你安装成功了:
./install.sh /usr/local/bin /usr/local/lib/p7zip /usr/local/man /usr/local/share/doc/p7zip
- installing /usr/local/bin/7za
- installing /usr/local/man/man1/7z.1
- installing /usr/local/man/man1/7za.1
- installing /usr/local/man/man1/7zr.1
- installing /usr/local/share/doc/p7zip/README
- installing /usr/local/share/doc/p7zip/ChangeLog
- installing HTML help in /usr/local/share/doc/p7zip/DOC 复制代码
这时如果发现乱码,请执行命令
7zip命令使用方法:
7zip命令7za
具体路径/usr/local/bin/7za,shell脚本记得写全,不然计划任务无法调用提示命令未找到
7za {a|d|l|e|u|x} 压缩包文件名 {文件列表或目录,可选}
a 向压缩包里添加文件或创建压缩包,如向vpser.7z添加vpser001.jpg,执行:7za a vpser.7z vpser001.jpg;将vpser目录压缩打包执行:7za a vpser.7z vpser;
d 从压缩里删除文件,如将vpser.7z里的test.jpg删除,执行:7za d vpser.7z test.jpg
l 列出压缩包里的文件,如列出vpser.7z里的文件,执行:7za l vpser.7z
e 解压到当前目录,目录结构会被破坏,如vpser.rar内有如下目录及文件123/456/789.html,执行:7za e vpser.rar,目录123和456及文件789.html都会存放在当前目录下。
x 以完整路径解压。
-p 指定密码。
7za x archive.zip -psecret :将设有密码“secret”的压缩档案 archive.zip 中所有文件释放。
打包111.sql文件为111.7z,并且设置密码为123456
打包方法:7za a 111.7z 111.sql -mx=0 -p123456
解包方法:7za x 111.7z -p123456
解包方法(文件已存在时直接覆盖):7za -y x 111.7z -p123456
进行分卷,第一个分卷为10MB;第二个为15MB,剩下全部为20 MB。
7za a 111.7z 111.sql -mx=0 -p123456 -v10m -v15m -v20m
官方帮助资料7-Zip (a) [64] 16.02 : Copyright (c) 1999-2016 Igor Pavlov : 2016-05-21
p7zip Version 16.02 (locale=C,Utf16=off,HugeFiles=on,64 bits,32 CPUs x64)
Usage: 7za <command> [<switches>...] <archive_name> [<file_names>...]
[<@listfiles...>]
<Commands>
a : Add files to archive
b : Benchmark
d : Delete files from archive
e : Extract files from archive (without using directory names)
h : Calculate hash values for files
i : Show information about supported formats
l : List contents of archive
rn : Rename files in archive
t : Test integrity of archive
u : Update files to archive
x : eXtract files with full paths
<Switches>
-- : Stop switches parsing
-ai[r[-|0]]{@listfile|!wildcard} : Include archives
-ax[r[-|0]]{@listfile|!wildcard} : eXclude archives
-ao{a|s|t|u} : set Overwrite mode
-an : disable archive_name field
-bb[0-3] : set output log level
-bd : disable progress indicator
-bs{o|e|p}{0|1|2} : set output stream for output/error/progress line
-bt : show execution time statistics
-i[r[-|0]]{@listfile|!wildcard} : Include filenames
-m{Parameters} : set compression Method
-mmt[N] : set number of CPU threads
-o{Directory} : set Output directory
-p{Password} : set Password
-r[-|0] : Recurse subdirectories
-sa{a|e|s} : set Archive name mode
-scc{UTF-8|WIN|DOS} : set charset for for console input/output
-scs{UTF-8|UTF-16LE|UTF-16BE|WIN|DOS|{id}} : set charset for list files
-scrc[CRC32|CRC64|SHA1|SHA256|*] : set hash function for x, e, h commands
-sdel : delete files after compression
-seml[.] : send archive by email
-sfx[{name}] : Create SFX archive
-si[{name}] : read data from stdin
-slp : set Large Pages mode
-slt : show technical information for l (List) command
-snh : store hard links as links
-snl : store symbolic links as links
-sni : store NT security information
-sns[-] : store NTFS alternate streams
-so : write data to stdout
-spd : disable wildcard matching for file names
-spe : eliminate duplication of root folder for extract command
-spf : use fully qualified file paths
-ssc[-] : set sensitive case mode
-ssw : compress shared files
-stl : set archive timestamp from the most recently modified file
-stm{HexMask} : set CPU thread affinity mask (hexadecimal number)
-stx{Type} : exclude archive type
-t{Type} : Set type of archive
-u[-][p#][q#][r#][x#][y#][z#][!newArchiveName] : Update options
-v{Size}[b|k|m|g] : Create volumes
-w[{path}] : assign Work directory. Empty path means a temporary directory
-x[r[-|0]]{@listfile|!wildcard} : eXclude filenames
-y : assume Yes on all queries 复制代码