17z(1)                       General Commands Manual                      7z(1)
2
3
4

NAME

6       7z - A file archiver with high compression ratio format
7

SYNOPSIS

9       7z   <command>   [<switches>...  ]  <archive_name>  [<file_names>...  ]
10       [<@listfiles>... ]
11

DESCRIPTION

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       7z uses plugins to handle archives, so it might be slightly slower than
21       7za(1) but can handle more archive formats.
22

COMMANDS

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

SWITCHES

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 | 7z 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. 7z x -so directory.tar.7z | tar xf -)
129
130       -spd   Disable wildcard matching for file names
131
132       -spe   Eliminate duplication of root folder for extract command
133
134       -spf   Use fully qualified file paths
135
136       -ssc[-]
137              Set sensitive case mode
138
139       -ssw   Compress shared files
140
141       -stl   Set archive timestamp from the most recently modified file
142
143       -stm{HexMask}
144              Set CPU thread affinity mask (hexadecimal number)
145
146       -stx{Type}
147              Exclude archive type
148
149       -t{Type}
150              Set type of archive
151
152       -u[-][p#][q#][r#][x#][y#][z#][!newArchiveName]
153              Update options
154
155       -v{Size}[b|k|m|g]
156              Create volumes
157
158       -w[path]
159              Set working directory. Empty path means a temporary directory
160
161       -x[r[-|0]]]{@listfile|!wildcard}
162              Exclude filenames
163
164       -y     Assume Yes on all queries
165

DIAGNOSTICS

167       7-Zip returns the following exit codes:
168
169              0      Normal (no errors or warnings detected)
170
171              1      Warning (Non fatal error(s)).  For  example,  some  files
172                     cannot  be read during compressing, so they were not com‐
173                     pressed
174
175              2      Fatal error
176
177              7      Bad command line parameters
178
179              8      Not enough memory for operation
180
181              255    User stopped the process with control-C (or similar)
182

Backup and limitations

184       DO NOT USE the 7-zip format for backup purpose on Linux/Unix because :
185        - 7-zip does not store the owner/group of the file.
186
187
188       On Linux/Unix, in order to backup directories you must use tar :
189        - to backup a directory  : tar cf  -  directory  |  7z  a  -si  direc‐
190       tory.tar.7z
191        - to restore your backup : 7z x -so directory.tar.7z | tar xf -
192
193       If  you  want  to send files and directories (not the owner of file) to
194       others Unix/MacOS/Windows users, you can use the 7-zip format.
195
196         example : 7z a directory.7z  directory
197
198
199       Do not use "-r" because this flag does not do what you think.
200
201       Do not use directory/* because of ".*" files (example  :  "directory/*"
202       does not match "directory/.profile")
203

EXAMPLE 1

205       7z a -t7z -m0=lzma -mx=9 -mfb=64 -md=32m -ms=on archive.7z dir1
206              adds all files from directory "dir1" to archive archive.7z using
207              "ultra settings"
208
209       -t7z   7z archive
210
211       -m0=lzma
212              lzma method
213
214       -mx=9  level of compression = 9 (Ultra)
215
216       -mfb=64
217              number of fast bytes for LZMA = 64
218
219       -md=32m
220              dictionary size = 32 megabytes
221
222       -ms=on solid archive = on
223

EXAMPLE 2

225       7z a -sfx archive.exe dir1
226              add all files from directory "dir1" to SFX  archive  archive.exe
227              (Remark : SFX archive MUST end with ".exe")
228

EXAMPLE 3

230       7z a -mhe=on -pmy_password archive.7z a_directory
231              add  all  files from directory "a_directory" to the archive "ar‐
232              chive.7z" (with data and header archive encryption on)
233

SEE ALSO

235       7zr(1), 7za(1), p7zip(1), bzip2(1), gzip(1), zip(1),
236

HTML Documentation

238       /usr/share/doc/p7zip-full/DOC/MANUAL/start.htm
239

AUTHOR

241       Written for Debian by  Mohammed  Adnene  Trojette.  Updated  by  Robert
242       Luberda.
243
244
245
2467-Zip                           March 6th, 2016                          7z(1)
Impressum