1lha(1) General Commands Manual lha(1)
2
3
4
6 lha - compression tool for .lzh archive files.
7
9 lha [-]{lvtxep[q{num}][finv]}[w=<dir>] archive_file [file ...]
10
12 lha is a tool for extracting .lzh archive files. It also supports vari‐
13 ants of the .lzh archive, such as .lzs and .pma.
14
15 This version of the lha tool is part of Lhasa, a free implementation of
16 the .lzh format.
17
19 The lha tool has an unusual command syntax, compared to most other Unix
20 commands. The first parameter to the program specifies the command to
21 perform and all additional options. The second parameter specifies the
22 path to the archive file to operate on. Following this is a list of
23 wildcard patterns to match against the filenames of the archived files.
24
25 The first character of the command parameter specifies the command to
26 perform, which is one of the following:
27
28 -l List contents of the specified archive.
29
30 -v Verbosely list contents of the specified archive.
31
32 -t Test the integrity of the specified archive: decompress its con‐
33 tents and check the CRC.
34
35 -e or -x
36 Extract archive. Files are extracted to the current working di‐
37 rectory unless the 'w' option is specified.
38
39 -p Extract archive, sending decompressed files to stdout rather
40 than writing them to the filesystem as actual files. This is
41 useful when used as part of a shell pipeline.
42
44 The remainder of the command parameter is used to specify additional
45 options:
46
47 q[012] Quiet mode. Higher numbers suppress more output. Level 0 is nor‐
48 mal operation. If no number is specified, full suppression
49 (level 2) is used. The quiet option also turns on the force
50 overwrite option ('f').
51
52 f Force overwrite of existing files: do not prompt.
53
54 i Ignore paths of archived files: extract all archived files to
55 the same directory, ignoring subdirectories.
56
57 n Do not perform any actual operations: instead, perform a dry run
58 of the requested operation and describe what would have been
59 done on standard output.
60
61 v Verbose mode: causes extra information to be written to standard
62 output.
63
64 w=dir Specify destination directory for extracting files. This must be
65 the last option of the first parameter.
66
68 The following gives some basic description of the various different
69 supported compression formats (as listed when using the list command
70 documented above). All formats are variants on the LZSS compression
71 algorithm.
72
73 -lz4- Uncompressed (stored) data, as used by the original LArc tool.
74 This is not related to the LZ4 compression algorithm of the same
75 name.
76
77 -lz5-, -lzs-
78 Compression formats introduced with the original LArc tool.
79 -lzs- uses a 2KiB sliding window while -lz5- uses a 4KiB window.
80
81 -lhd- Directory entry. No data is stored, only headers.
82
83 -lh0- Uncompressed (stored) data, as used in LHarc and LHa.
84
85 -lh1- Compression algorithm introduced with LHarc. This uses a 4KiB
86 sliding window with dynamic Huffman encoding.
87
88 -lh4-, -lh5-, -lh6-, -lh7-
89 New algorithm introduced with LHa (aka LHarc v2.0). The original
90 versions (-lh4- and -lh5-) used 8KiB and 16KiB sliding window
91 sizes, respectively. Later versions introduced new variants
92 with larger window sizes: -lh6- (64KiB) and -lh7- (128KiB).
93
94 -lhx- Variant on the -lh4- format listed above introduced by
95 UNLHA32.dll that extends the window size to 1MiB.
96
97 -lk7- Variant on the -lh4- format listed above that was introduced by
98 the LHark tool (a fork of LHa). This is actually named -lh7-
99 within the archive files, but Lhasa renames it internally to
100 avoid clashing with the other algorithm of the same name. Uses a
101 128KiB sliding window, with some minor improvement to the algo‐
102 rithm.
103
104 -pm0- Uncompressed (stored) data, as used by the PMarc tool.
105
106 -pm1- Algorithm used by version 1 of the PMarc tool.
107
108 -pm2- Algorithm used by version 2 of the PMarc tool.
109
111 The following formats are not currently supported by Lhasa (but possi‐
112 bly will be in the future):
113
114 -lh2-, -lh3-
115 These formats can be decompressed by LHa v2.0 but the tool could
116 not actually generate archives with these formats; they appear
117 to have only been supported in beta versions before the v2.0 re‐
118 lease. As a result, few if any examples exist in the wild.
119
120 -lh8-, -lh9-, -lha-, -lhb-, -lhc-, -lhe-
121 Extensions of the -lh4- format to even larger window sizes.
122
123 -pc1- Format generated by the PopCom! compression utility for CP/M.
124
125 If you encounter examples of these in the wild, please get in touch.
126
128 Here are some examples for how to invoke the program:
129
130 lha -v foobar.lzs
131 List the contents of the file foobar.lzs (producing verbose out‐
132 put).
133
134 lha -xf foobar.exe
135 Extract the contents of a self-extracting archive file named
136 foobar.exe to the current directory, overwriting existing files
137 with the same names if they exist.
138
139 lha -xqw=/tmp foobar.lzh
140 Extract the contents of foobar.lzh to /tmp, overwriting any ex‐
141 isting files found there, and suppressing normal output (similar
142 to how other Unix tools such as cp(1) or tar(1) act silently by
143 default).
144
146 unzip(1), tar(1), gzip(1), bzip2(1), xz(1), lzip(1)
147
149 The .lzh format originated with Kazuhiko Miki's MS-DOS archive tool,
150 LArc, using the LZSS algorithm developed by Haruhiko Okumura, and the
151 .lzs filename extension. The container format was reused for LHarc, by
152 Haruyasu Yoshizaki (Yoshi), which used a new algorithm named LZHUF and
153 the .lzh extension. In later versions, LHarc was renamed to LHA and ex‐
154 tended with more effective compression algorithms.
155
156 Versions of the LHA tool were later ported to various different operat‐
157 ing systems, including the Amiga, Atari, MacOS, OS/2 and Unix. A tool
158 for MSX-DOS named PMarc reused the container format with a new compres‐
159 sion algorithm (.pma extension).
160
161 The Unix version of the tool was developed by Masaru Oki, Nobutaka
162 Watazaki and Tsugio Okamoto, but was released under a software license
163 that does not conform to the Free Software or Open Source Definitions.
164 Lhasa was developed as a drop-in replacement that is Free Software and
165 Open Source.
166
168 The current version does not allow the creation of new archive files.
169
170 Some obscure compression algorithms are not currently supported (see
171 the UNSUPPORTED FORMATS section above).
172
173 The tool does not currently do text format conversion for non-ASCII
174 filenames when listing the contents of archives. Non-ASCII characters
175 are replaced by a question mark.
176
178 Lhasa was written and is maintained by Simon Howard.
179
181 Copyright © 2011, 2012 Simon Howard.
182
183 Permission to use, copy, modify, and/or distribute this software for
184 any purpose with or without fee is hereby granted, provided that the
185 above copyright notice and this permission notice appear in all copies.
186
187 THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WAR‐
188 RANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES
189 OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE
190 FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAM‐
191 AGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN
192 AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
193 OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
194
195
196
197 lha(1)