The “unzip” command

Use this command to perform various operations on a ZIP archive file’s contents.

The “<ZIPFILE>” variable is the complete path and filename of the Zip file to be targeted, while the “ <FILE-or-DIRECTORY>” variable should be the file or directory that will be the target of the operation. This is all based on the selected “ <OPTIONS>” and “ <MODIFIERS>” set.

unzip <OPTIONS> [MODIFIER] <ZIPFILE> [<OPTIONS>] <FILE_or_DIRECTORY>

Available options

The <OPTION> variable displayed in the above example can be populated with one or more of the following options:

Note: Only a single hyphen (-) is required when calling out more than one option (e.g., -fldv would be set to include the -f, -l, -d and -v options in a single command.
Option Description
-f Uncompress only files that pre-exist on the disk and that are updated, use them to refresh the existing files, and if the files do not pre-exist, do not uncompress them and create them on the disk.
-l Display the ZIP archive file’s contents using a shortened format.
-d Uncompress files to directory.
-p Display the contents of all files contained in the ZIP archive file using binary format.
-t Check the ZIP archive file’s contents for errors.
-u Uncompress all files, updating existing ones, and creating new ones as necessary.
-v Display the ZIP archive file’s contents using the verbose (long) format.
-x Do not extract the file or files that follow.
-z Show the comment in the ZIP archive file, if present.
-h, --help Display help information for this command.

Available modifiers

The <MODIFIER> variable displayed in the above example can be populated with one of the following modifiers:

Modifier Description
-a If files are recognized as text, extract them as such, not as binary
-aa Extract all files in the archive as text files, regardless of whether they actually are
-b Extract all files as binary, regardless of whether they are text
-C Do not apply case-sensitivity when extracting files
-j Do not re-create the ZIP archive file’s directory structure when extracting files; extract all files to the working directory
-L If a file was created on an uppercase-only system, convert its file name to lowercase
-LL Convert all uppercase file names to lowercase
-n If files already exist, do not overwrite them
-o Do not prompt before overwriting files
-q Perform the operation quietly; do not display the operation’s step-by-step execution
-qq Perform the operation even more quietly than with -q
-v Display diagnostic information (used as unzip -v )
-X Preserve user and group IDs

Considerations when using "unzip"

  • The unzip will take some time proportional to the number of files created.
  • The original zip archive will remain uploaded to NetStorage.
  • The standard zip32 archives supported are limited to 4,294,967,295 (2^32^-1) bytes and 65,535 (2^16^-1) files.
  • Capabilities beyond the basic UNIX "unzip" are not supported.

    For example, zip archives with encryption, bzip compression, and zip64 format are not supported.

You should try Serve from Zip

You might be able to serve your files from within an uploaded zip archive on NetStorage without unzipping it, by using Serve from Zip. Serve from Zip supports much larger files and the zip64 file format. If you can use it, you won't need to use this unzip command. See if the Serve from Zip considerations are compatible with your workflow.