17za(1) General Commands Manual 7za(1)
2
3
4
6 7za - A file archiver with high compression ratio format
7
9 7za <command> [<switches>... ] <archive_name> [<file_names>... ]
10 [<@listfiles>... ]
11
13 7-Zip is a file archiver supporting 7z (that implements LZMA compres‐
14 sion algorithm featuring very high compression ratio), LZMA2, XZ, ZIP,
15 Zip64, CAB, RAR (it was removed due a non-free license), ARJ, GZIP,
16 BZIP2, TAR, CPIO, RPM, ISO, most filesystem images and DEB formats.
17 Compression ratio in the new 7z format is 30-50% better than ratio in
18 ZIP format.
19
20 7za is a stand-alone executable. 7za handles fewer archive formats
21 than 7z(1).
22
24 a Add files to archive
25
26 b Benchmark
27
28 d Delete files from archive
29
30 e Extract files from archive (without using directory names)
31
32 h Calculate hash values for files
33
34 i Show information about supported formats
35
36 l List contents of archive
37
38 rn Rename files in archive
39
40 t Test integrity of archive
41
42 u Update files to archive
43
44 x eXtract files with full paths
45
47 -- Stop switches parsing
48
49 -ai[r[-|0]]{@listfile|!wildcard}
50 Include archives
51
52 -ax[r[-|0]]{@listfile|!wildcard}
53 Exclude archives
54
55 -ao{a|s|t|u}
56 Set Overwrite mode
57
58 -an Disable archive_name field
59
60 -bb[0-3]
61 Set output log level
62
63 -bd Disable progress indicator
64
65 -bs{o|e|p}{0|1|2}
66 Set output stream for output/error/progress line
67
68 -bt Show execution time statistics
69
70 -i[r[-|0]]{@listfile|!wildcard}
71 Include filenames
72
73 -m{Parameters}
74 Set Compression Method (see /usr/share/doc/p7zip/DOC/MANUAL/cmd‐
75 line/switches/method.htm from the p7zip-full package for a list
76 of methods)
77
78 -o{Directory}
79 Set Output directory
80
81 -p{Password}
82 Set Password (NOTE: this flag does not work with 7zr)
83
84 -r[-|0]
85 Recurse subdirectories (CAUTION: this flag does not do what you
86 think, avoid using it)
87
88 -sa{a|e|s}
89 Set archive name mode
90
91 -scc{UTF-8|WIN|DOS}
92 Set charset for for console input/output
93
94 -scs{UTF-8|UTF-16LE|UTF-16BE|WIN|DOS|{id}}
95 Set charset for list files
96
97 -scrc[CRC32|CRC64|SHA1|SHA256|*]
98 Set hash function for x, e, h commands
99
100 -sdel Delete files after compression
101
102 -seml[.]
103 Send archive by email
104
105 -sfx[{name}]
106 Create SFX archive
107
108 -si[{name}]
109 Read data from stdin (e.g. tar cf - directory | 7za a -si direc‐
110 tory.tar.7z)
111
112 -slp Set Large Pages mode
113
114 -slt Show technical information for l (List) command
115
116 -snh Store hard links as links
117
118 -snl Store symbolic links as links
119
120 -sni Store NT security information
121
122 -sns[-]
123 Store NTFS alternate streams
124
125 -sfx[{name}]
126 Create SFX archive
127
128 -so Write data to stdout (e.g. 7za x -so directory.tar.7z | tar xf
129 -)
130
131 -spd Disable wildcard matching for file names
132
133 -spe Eliminate duplication of root folder for extract command
134
135 -spf Use fully qualified file paths
136
137 -ssc[-]
138 Set sensitive case mode
139
140 -ssw Compress shared files
141
142 -stl Set archive timestamp from the most recently modified file
143
144 -stm{HexMask}
145 Set CPU thread affinity mask (hexadecimal number)
146
147 -stx{Type}
148 Exclude archive type
149
150 -t{Type}
151 Set type of archive
152
153 -u[-][p#][q#][r#][x#][y#][z#][!newArchiveName]
154 Update options
155
156 -v{Size}[b|k|m|g]
157 Create volumes
158
159 -w[path]
160 Set working directory. Empty path means a temporary directory
161
162 -x[r[-|0]]]{@listfile|!wildcard}
163 Exclude filenames
164
165 -y Assume Yes on all queries
166
168 7-Zip returns the following exit codes:
169
170 0 Normal (no errors or warnings detected)
171
172 1 Warning (Non fatal error(s)). For example, some files
173 cannot be read during compressing, so they were not com‐
174 pressed
175
176 2 Fatal error
177
178 7 Bad command line parameters
179
180 8 Not enough memory for operation
181
182 255 User stopped the process with control-C (or similar)
183
185 DO NOT USE the 7-zip format for backup purpose on Linux/Unix because :
186 - 7-zip does not store the owner/group of the file.
187
188
189 On Linux/Unix, in order to backup directories you must use tar :
190 - to backup a directory : tar cf - directory | 7za a -si direc‐
191 tory.tar.7z
192 - to restore your backup : 7za x -so directory.tar.7z | tar xf -
193
194 If you want to send files and directories (not the owner of file) to
195 others Unix/MacOS/Windows users, you can use the 7-zip format.
196
197 example : 7za a directory.7z directory
198
199
200 Do not use "-r" because this flag does not do what you think.
201
202 Do not use directory/* because of ".*" files (example : "directory/*"
203 does not match "directory/.profile")
204
206 7za a -t7z -m0=lzma -mx=9 -mfb=64 -md=32m -ms=on archive.7z dir1
207 adds all files from directory "dir1" to archive archive.7z using
208 "ultra settings"
209
210 -t7z 7z archive
211
212 -m0=lzma
213 lzma method
214
215 -mx=9 level of compression = 9 (Ultra)
216
217 -mfb=64
218 number of fast bytes for LZMA = 64
219
220 -md=32m
221 dictionary size = 32 megabytes
222
223 -ms=on solid archive = on
224
226 7za a -sfx archive.exe dir1
227 add all files from directory "dir1" to SFX archive archive.exe
228 (Remark : SFX archive MUST end with ".exe")
229
231 7za a -mhe=on -pmy_password archive.7z a_directory
232 add all files from directory "a_directory" to the archive "ar‐
233 chive.7z" (with data and header archive encryption on)
234
236 7zr(1), 7z(1), p7zip(1), bzip2(1), gzip(1), zip(1),
237
239 /usr/share/doc/p7zip-full/DOC/MANUAL/start.htm
240
242 Written for Debian by Mohammed Adnene Trojette. Updated by Robert
243 Luberda.
244
245
246
2477-Zip March 6th, 2016 7za(1)