17z(1) General Commands Manual 7z(1)
2
3
4
6 7z - A file archiver with highest compression ratio
7
9 7z [adeltux] [-] [SWITCH] <ARCHIVE_NAME> <ARGUMENTS>...
10
12 7-Zip is a file archiver with the highest compression ratio. The pro‐
13 gram supports 7z (that implements LZMA compression algorithm), ZIP,
14 CAB, ARJ, GZIP, BZIP2, TAR, CPIO, RPM and DEB formats. Compression
15 ratio in the new 7z format is 30-50% better than ratio in ZIP format.
16
17 7z uses plugins to handle archives.
18
20 a Add
21
22 d Delete
23
24 e Extract
25
26 l List
27
28 t Test
29
30 u Update
31
32 x eXtract with full paths
33
35 -ai[r[-|0]]{@listfile|!wildcard}
36 Include archives
37
38 -ax[r[-|0]]{@listfile|!wildcard}
39 eXclude archives
40
41 -bd Disable percentage indicator
42
43 -i[r[-|0]]{@listfile|!wildcard}
44 Include filenames
45
46 -l don't store symlinks; store the files/directories they point to
47 (CAUTION : the scanning stage can never end because of recursive
48 symlinks like 'ln -s .. ldir')
49
50 -m{Parameters}
51
52 -mhe=on|off
53 7z format only : enables or disables archive header encryption
54 (Default : off)
55
56 -o{Directory}
57 Set Output directory
58
59 -p{Password}
60 Set Password
61
62 -r[-|0]
63 Recurse subdirectories (CAUTION: this flag does not do what you
64 think, avoid using it)
65
66 -sfx[{name}]
67 Create SFX archive
68
69 -si Read data from StdIn (eg: tar cf - directory | 7z a -si direc‐
70 tory.tar.7z)
71
72 -so Write data to StdOut (eg: % echo foo | 7z a dummy -tgzip -si -so
73 > /dev/null)
74
75 -slt Sets technical mode for l (list) command
76
77 -t{Type}
78 Type of archive (7z, zip, gzip, bzip2 or tar. 7z format is
79 default)
80
81 -v{Size}[b|k|m|g]
82 Create volumes
83
84 -u[-][p#][q#][r#][x#][y#][z#][!newArchiveName]
85 Update options
86
87 -w[path]
88 Set Working directory
89
90 -x[r[-|0]]]{@listfile|!wildcard}
91 Exclude filenames
92
93 -y Assume Yes on all queries
94
96 7-Zip returns the following exit codes:
97
98 0 Normal (no errors or warnings detected)
99
100 1 Warning (Non fatal error(s)). For example, some files
101 cannot be read during compressing. So they were not com‐
102 pressed
103
104 2 Fatal error
105
106 7 Bad command line parameters
107
108 8 Not enough memory for operation
109
110 255 User stopped the process with control-C (or similar)
111
113 DO NOT USE the 7-zip format for backup purpose on Linux/Unix because :
114 - 7-zip does not store the owner/group of the file.
115
116
117 On Linux/Unix, in order to backup directories you must use tar :
118 - to backup a directory : tar cf - directory | 7za a -si direc‐
119 tory.tar.7z
120 - to restore your backup : 7za x -so directory.tar.7z | tar xf -
121
122 If you want to send files and directories (not the owner of file) to
123 others Unix/MacOS/Windows users, you can use the 7-zip format.
124
125 example : 7za a directory.7z directory
126
127
128 Do not use "-r" because this flag does not do what you think.
129
130 Do not use directory/* because of ".*" files (example : "directory/*"
131 does not match "directory/.profile")
132
134 7z a -t7z -m0=lzma -mx=9 -mfb=64 -md=32m -ms=on archive.7z dir1
135 adds all files from directory "dir1" to archive archive.7z using
136 "ultra settings"
137
138 -t7z 7z archive
139
140 -m0=lzma
141 lzma method
142
143 -mx=9 level of compression = 9 (Ultra)
144
145 -mfb=64
146 number of fast bytes for LZMA = 64
147
148 -md=32m
149 dictionary size = 32 megabytes
150
151 -ms=on solid archive = on
152
154 7z a -sfx archive.exe dir1
155 add all files from directory "dir1" to SFX archive archive.exe
156 (Remark : SFX archive MUST end with ".exe")
157
159 7z a -mhe=on -pmy_password archive.7z a_directory
160 add all files from directory "a_directory" to the archive "ar‐
161 chive.7z" (with data and header archive encryption on)
162
164 7za(1), 7zr(1), bzip2(1), gzip(1), zip(1)
165
168 Written for Debian by Mohammed Adnene Trojette.
169
170
171
172Mohammed Adnene Trojette September 1 2006 7z(1)