LinuxCommandLibrary

unzipsfx

Extract self-extracting ZIP archives

TLDR

Create a self-extracting binary file of a Zip archive

$ cat unzipsfx [path/to/archive.zip] > [filename] && chmod 755 [filename]
copy

Extract a self-extracting binary in the current directory
$ [./path/to/binary]
copy

Test a self-extracting binary for errors
$ [./path/to/binary] -t
copy

Print content of a file in the self-extracting binary without extraction
$ [./path/to/binary] -c [path/to/filename]
copy

Print comments on Zip archive in the self-extracting binary
$ [./path/to/binary] -z
copy

SYNOPSIS

sfx_archive_name [-f] [-o] [-d exdir] [-x file(s)...] [-j] [-L] [-V]

PARAMETERS

-d exdir
    Extract files into the specified directory exdir instead of the current working directory.

-f
    Freshen existing files. Only extract files that are newer than the existing copies, and do not create new files.

-o
    Overwrite existing files without prompting. This bypasses any confirmation prompts for overwriting files.

-x file(s)...
    Exclude the specified files or patterns from extraction. Multiple patterns can be listed and separated by spaces.

-j
    Junk paths. Do not recreate the directory structure stored in the archive; extract all files directly into the target directory.

-L
    Convert all extracted filenames to lowercase. Useful for compatibility with case-insensitive file systems or when dealing with archives from different operating systems.

-V
    View archive contents (list only). Instead of extracting, list the files contained within the archive. This is similar to unzip -l.

DESCRIPTION

The unzipsfx command is a specialized utility from the Info-ZIP family, designed to create self-extracting archives (SFX files) from standard Zip archives. It achieves this by being prepended to a PKZIP-compatible .ZIP file, effectively embedding the unzipping engine directly within the archive itself.

When the resulting SFX file is executed, it automatically extracts its contents without requiring a separate unzip utility to be pre-installed on the system. This makes it ideal for distributing software or data in a self-contained, portable manner, especially in environments where users might not have traditional archive tools readily available. It supports many of the common unzip options, allowing control over the extraction process.

CAVEATS

unzipsfx is primarily designed for self-extraction and lacks many of the advanced options and interactive features found in the full unzip utility. It expects to be prepended to a valid .ZIP archive; attempting to run it standalone or on a non-SFX zip file directly for extraction is not its intended use. File permissions and ownership might not always be perfectly preserved across different operating systems.

HISTORY

The unzipsfx utility is part of the long-standing Info-ZIP project, which provides portable, open-source implementations of the Zip and UnZip compression and archiving utilities. Its development aimed to address the need for easily distributable, self-contained archives that could be executed on a wide range of Unix-like systems without external dependencies. It has been a staple for software distribution in the Unix/Linux world for decades, allowing developers to create 'single-file' installers or package distributions.

SEE ALSO

unzip(1), zip(1)

Copied to clipboard