lha man page

LHa for UNIX — Traditional compressor and archiver.

Synopsis

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]

or

lha archive_file.lzh [specific files]

Description

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.

Commands

-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.

PERMISSION

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

UID/GID

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

PACKED

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

SIZE

The original file size.

RATIO

Compressed ratio (PACKED / SIZE * 100).

METHOD

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

-lh0-

no compressed.

-lzs-

2k sliding dictionary (created by the LArc)

-lz4-

no compressed. (created by the LArc)

-lz5-

4k sliding dictionary (created by the LArc)

-lh1-

4k sliding dictionary and dynamic Huffman encoding.

-lh2-

8k sliding dictionary and dynamic Huffman encoding.

-lh3-

8k sliding dictionary and static Huffman encoding.

-lh4-

4k sliding dictionary and static Huffman encoding.

-lh5-

8k sliding dictionary and static Huffman encoding.

-lh6-

32k sliding dictionary and static Huffman encoding.

-lh7-

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-.

CRC

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

STAMP

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

LV

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.)

NAME

Filename or directory name.

-u

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.

-m

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

-d

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

-p

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

   ::::::::
   filename
   ::::::::
   contents of the file.....

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

-t

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

Options

-q[num]

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.

-v

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.

-n

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

-f

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.

-t

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.

-o[5-7]

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.

-d

When archiving, specified files are removed from the disk.

-i

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

-z

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

-g

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).

-e

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.

-b

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

-w=dir

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

An equal mark is omittable like, -w dir.

-x=pattern

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

--archive-kanji-code={euc,sjis,utf8,cap,none}

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.

--system-kanji-code={euc,sjis,utf8,cap,none}

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

--extract-broken-archive

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

--convert-filename-case

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.

--timestamp-archive

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

--ignore-mac-files

When archiving, the Mac specific files are ignored.

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

--traditional

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

--help

Show the briefly usage.

--version

Show the version string.

See Also

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

Author

Koji Arai <arai@users.sourceforge.jp>

History

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

xdms(1).

February 2008 LHa for UNIX User Commands