← 返回命令列表

Linux command

7z 命令

文件

复制后可按需替换文件名、目录或参数。

常用示例

Create archive

7z a [archive.7z] [files...]

Extract archive

7z x [archive.7z]

Extract to specific directory

7z x [archive.7z] -o[directory]

List archive contents

7z l [archive.7z]

Test archive integrity

7z t [archive.7z]

Create with password

7z a -p[password] [archive.7z] [files]

Create with maximum compression

7z a -mx=9 [archive.7z] [files]

说明

7z is the command-line interface to the 7-Zip archiver, supporting many formats: 7z, ZIP, TAR, GZIP, BZIP2, XZ, and more. The 7z format offers high compression ratios using LZMA/LZMA2 algorithms, often 30-70% better than ZIP. It also supports AES-256 encryption and multi-volume archives. Extraction supports many additional formats including RAR, CAB, ISO, and others (read-only for some formats).

参数

-o_dir_
Output directory (no space after -o)
-p_password_
Set password
-mx=_n_
Compression level (0=store, 9=ultra)
-t_type_
Archive type (7z, zip, tar, gzip, bzip2)
-mhe=on
Encrypt filenames (7z format)
-r
Recurse subdirectories
-y
Assume yes to all queries
-v_size_
Create volumes (e.g., -v100m)

FAQ

What is the 7z command used for?

7z is the command-line interface to the 7-Zip archiver, supporting many formats: 7z, ZIP, TAR, GZIP, BZIP2, XZ, and more. The 7z format offers high compression ratios using LZMA/LZMA2 algorithms, often 30-70% better than ZIP. It also supports AES-256 encryption and multi-volume archives. Extraction supports many additional formats including RAR, CAB, ISO, and others (read-only for some formats).

How do I run a basic 7z example?

Run `7z a [archive.7z] [files...]` in a terminal, then adjust file names, paths, flags, or remote targets for your system.

What does -o_dir_ do in 7z?

Output directory (no space after -o)