LinuxCommandLibrary

funzip

Extract compressed files with the .zip suffix

TLDR

Print the content of the first member in a Zip archive

$ funzip [path/to/archive.zip]
copy

Print the content in a gzip archive
$ funzip [path/to/archive.gz]
copy

Decrypt a Zip or gzip archive and print the content
$ funzip -password [password] [path/to/archive]
copy

SYNOPSIS

funzip [unzip_options] file.zip [files_to_view...]
Note: funzip typically passes its arguments directly to the underlying unzip command.

PARAMETERS

unzip_options
    Options that are passed directly to the underlying unzip command. Common options used with funzip include:

  • -l: List contents of the .zip archive (often the default behavior for funzip when no specific files are given).
  • -v: Verbose listing of the .zip archive contents, showing details like sizes, compression methods, and dates.
  • -p: Extract files to standard output (stdout). When used with a specific file within the archive, funzip often pipes this output to a pager for viewing.
  • -t: Test the integrity of the .zip archive contents.


file.zip
    The path to the .zip archive file to be inspected or viewed.

files_to_view...
    Optional. Specifies one or more specific files within the archive whose content should be viewed. If omitted, funzip typically lists the archive's overall contents rather than displaying a specific file's content.

DESCRIPTION

funzip is a non-standard Linux command, typically implemented as a shell script or alias, designed to provide a convenient way to view the contents of a .zip archive. Instead of extracting files to disk, funzip usually lists the archive's contents (similar to unzip -l or unzip -v) or pipes the content of a specified file from within the archive directly to a pager program like less or more.
This allows for quick inspection of archive metadata or file content without modifying the filesystem. Its primary purpose is to "funnel" the output of unzip through a viewer program, making it easy to browse ZIP files without full extraction.

CAVEATS

funzip is not a standard executable in the unzip package or core Linux utilities; it's commonly a user-defined alias or a shell script. Its exact behavior (e.g., which pager it uses, default options) can vary significantly depending on its implementation on a given system. It relies on the unzip utility being installed and accessible in the system's PATH.

TYPICAL IMPLEMENTATION

A common shell script implementation of funzip might look like this:

#!/bin/sh
if [ "$#" -eq 1 ]; then
unzip -l "$1" | less
else
unzip -p "$@" | less
fi

This example first tries to list the archive's contents if only an archive path is provided. Otherwise, if additional arguments are present (assumed to be filenames within the archive), it attempts to extract those specific files to standard output and pipes them to less for viewing. Actual implementations may vary widely depending on the creator's preferences and system configuration.

HISTORY

funzip does not have a formal development history like standard Linux commands. It emerged as a common convenience script or alias within the Unix/Linux community to streamline the process of viewing ZIP archive contents without extraction. Its creation was driven by the desire for a quick "peek" functionality, often leveraging the piping capabilities of the shell with unzip and a pager, making a non-interactive process interactive for quick inspections.

SEE ALSO

unzip(1), zip(1), less(1), more(1), cat(1)

Copied to clipboard