lha man page

LHa for UNIX — Traditional compressor and archiver.


lha [-]command[options] [-options ...] archive_file.lzh [files...]

Create an archive
lha c archive_file.lzh files or directories.
Extract the archive
lha x archive_file.lzh [specific files]
List the archive
lha l archive_file.lzh [specific files]


lha archive_file.lzh [specific files]


The LHa for UNIX is an archiver and compressor using the LZSS and the Huffman encoding compression algorithm. It is possible to create the archive file called the "LZH" file, and possible to extract it.

It is possible to extract the self-extracting archive file called the SFX file (mainly created on the MS-DOS and the MS-Windows), but impossible to create it.


-c, -a

Specified files are compressed and archived into an archive file. When the directory path is specified, files under the directory are archived recursively.

The -c command creates new archive. When the archive file already exists, it is overwritten. The -a command creates new archive or appends to existent archive.

-x, -e

The -x command extracts uncompressed files from the archive file. When the specific_files is specified, Only these files or directories are extracted. The -e command is synonym of -x.

-l, -v

The -l command lists the contents of archive to stdout. The -v command is more verbosely command. The term of list is below.


For the Unix specific archive, it is permission string like ls(1). For the others, it is the string of OS type.


For the Unix specific archive, it is user-id and group-id. For the others, it is space only.


The size of compressed file. it is shown by the -v command.


The original file size.


Compressed ratio (PACKED / SIZE * 100).


The string of the compressing method.  it is shown by the -v command.


no compressed.


2k sliding dictionary (created by the LArc)


no compressed. (created by the LArc)


4k sliding dictionary (created by the LArc)


4k sliding dictionary and dynamic Huffman encoding.


8k sliding dictionary and dynamic Huffman encoding.


8k sliding dictionary and static Huffman encoding.


4k sliding dictionary and static Huffman encoding.


8k sliding dictionary and static Huffman encoding.


32k sliding dictionary and static Huffman encoding.


64k sliding dictionary and static Huffman encoding.

-lhd- directory

The LHa for Unix is able to create the methods -lh0-, -lh1-, -lh5-, -lh6-, -lh7- and -lhd-.


The CRC-16 code. It is shown by the -v command.


The timestamp of the file. It is shown the full-time format with the -v option.


The header level. It is shown by the -v option.

The level 0 and 1 are deprecated. The level 2 header is widely used. The level 3 header is more improved, however, it is rarely used.

The LHa for Unix is able to create the 0, 1 and 2. (Level 3 is readable.)


Filename or directory name.


The -u command updates the archive. When the specified files are newer than the content of the archive, they are replaced. The -a command always replace with the specified files.


The -m command moves specified files into the archive. It is same as the -ad (-a command and -d option).


The -d command delete the specified files from the archive.


The -p command print the content of the archived files to stdout. Each contents are printed with filename as header string like below.

   contents of the file.....

If you wish to non-display the header string, use with the -q option.


The -t command is the same as the -x command except to non-extract actually. This command is used to check the archive file.



The -q option specifies the level of quiet mode. num is 0, 1, 2 or nothing.

The -q0 option is default level. The -q1 option inhibits the extracting indicator (progress bar). The -q2 option inhibits other output decoration. this option has the effects of the -f option. The -q is same as -q2.


When listing with the -l or the -v command, the -v option lists more verbosely.

Elements are listed one file per two lines. The first line shows the filename, following line shows other elements and the timestamp (full-time format) and the header level.

In special case, the -v command trailing two -v options like, lha vvv archive_file.lzh shows the header dump. This is a debugging feature.


The -n option displays the message instead of doing the command action.


Force extraction. When extracted file already exists, normally, lha asks for the Overwriting, or Skipping or All files skipping. This option forces overwrite without asking.


The -t option treats archiving or extracting files as text files. When extracting, CR codes on the end of each lines are removed. (convert DOS format text to UNIX format text) When archiving, oppositely, CR codes append on the end of each lines. (convert UNIX format text to DOS format text) With the -e option, KANJI code are converted as well.


When archiving, the -o option specifies the compressing method. the -o5 means to use the -lh5- method. It is widely used and default method. the -o6 and -o7 means to use the -lh6- and -lh7- method. These methods reduced archive file more than the -lh5- method. Just the -o means to use the -lh1- method.

It is possible to include some methods in an archive file.


When archiving, specified files are removed from the disk.


When extracting, ignore the directory path. extracting file is put flatten on the current directory.


When archiving, do not compress the specified file. (archive with the -lh0- method)


When extracting, this option does nothing. It exists for historical reason.

When archiving with this option, archive with general (obsolete) header format. It uses the level 0 header, filename is uppercased in the archive,Unix specific elements such as permission, user-id and so on are not saved.

-0, -1, -2

The -0, -1 and -2 option specifies the version of the format header (called the header level).


When archiving, the -e option regard the coding of text as EUC-JP and convert it to Shift_JIS. When extracting, convert from Shift_JIS to EUC-JP.


When extracting, If it is possible, the MacBinary is interpreted. This option is experimental.


When extracting, extract files are create in the dir directory.

An equal mark is omittable like, -w dir.


When archiving, exclude files matched the glob pattern pattern. It is possible to use this option anywhere in the command line.

An equal mark is omittable like, -x pattern.

Long Options


Specifies the multi-byte encoding of the archived pathname.

Default is sjis as Shift_JIS.

On LZH file, the encoding of pathname in archive is not ruled. However, In Japan, Shift_JIS (exactly Windows-31J) is defacto standard.


This option specifies the encoding of the pathname on the filesystem. Default is euc as EUC-JP.


If CRC error occurrs when extracting, and its archive is created by old version of LHa for UNIX, this option may be last resort.


When extracting, the archive format is MS-DOS or Generic, and the whole filename (and directory name) is uppercase, extracted filename will be in lowercase.

It was default behavior on the old version of the LHa for UNIX. However, many software create the LZH archive with case-sensitive filename even if it is a MS-DOS type archive. Therefore, its behavior was deprecated as default.


When archiving or deleting, the archive timestamp reset most recent timestamp in the archive contents.


When archiving, the Mac specific files are ignored.

This option is same as the `-x "._*" -x ".DS_Store" -x "Icon\r"'.


Turn on the compatible mode for the old version. For now, same as the --convert-filename-case.


Show the briefly usage.


Show the version string.

See Also

zip(1), unzip(1), gzip(1), gunzip(1), zcat(1)


Koji Arai <arai@users.sourceforge.jp>


In 1988, Haruhiko Okumura developed the LZARI. It was experimental implementation used the LZSS and the arithmetic coding.

Kazuhiko Miki developed the LArc. (it was used the -lzs- method)

Haruyasu Yoshizaki developed the LZHUFF (it was experimental code with the LZSS and the Huffman coding), and developed the LHarc version 1.00.

In 1989, the LHarc was ported on UNIX by Yoichi Tagawa.

Haruhiko Okumura and Haruyasu Yoshizaki improved the algorithm of the LHarc.

In 1990, the LHx 2.00 which is the LHarc improvement was implemented by Haruyasu Yoshizaki. The ar002 was implemented by Haruhiko Okumura. It is distributed as the Public Domain Software.

In 1991, Haruyasu Yoshizaki improved the LHx and renamed to the LHa, and renamed again to the LHA.

In Japan, This version (LHA 2.10 - 2.13) was widely used on MS-DOS and MS-Windows. Many software and many documents are distributed with this archive format.

In 1992, It was ported on UNIX by Masaru Oki. It was called the LHa for UNIX, and it was improved by Nobutaka Watazaki, Tsugio Okamoto and many users.

The LHa for UNIX was used to exchange files for MS-DOS world, and its source codes might be used interestingly and implement another LZH archiver.

However, its license is vague. so it is not recognized as the Open Source Software defined by the Open Source Initiative.

Referenced By


February 2008 LHa for UNIX User Commands