MIAP Digital Literacy Command Line Guide

Learn about BASH commands!

View on GitHub

The unzip Command

Summary

The unzip command is used to extract files from ZIP archives, preserving directory structures and permissions. The command has many options which are described below.

Basic command structure

The simple syntax of the ‘unzip’ command:

unzip [options] filename.zip

Possible Flags

-d dir

The -d dir Specifies the destination directory listing for extracting documents. This choice allows users to choose a particular listing in which the contents of the ZIP record may be extracted.

-l

The -l Lists the contents of the ZIP file without extracting them. It provides an introduction to files and directories in the archive, together with permissions, compression ratio, and amendment timestamps.

-q

Operates in quiet mode, suppressing normal output for the duration of extraction. This is beneficial when you want to extract files without displaying unnecessary information.

‘-o’

Overwrites documents without prompting for confirmation. This option is available whilst you need to extract documents and replace current files without guidance.

‘-p’

Specifies a password for encrypted ZIP files. When handling password-protected archives, use this option to offer the desired password during extraction.

‘-e’

Extracts files from the ZIP archive even while keeping the directory structure. This is useful if you want to keep the same directory hierarchy as in the archive.

‘-t’

Tests the integrity of the ZIP archive, checking for any mistakes or corruption. It verifies whether or not the archive is legitimate before intending to extract.

‘-u’

Updates current files and adds new files from the ZIP archive. It guarantees that the handiest changed or new documents are extracted, keeping off pointless duplication.

Output

The unzip command has many different kinds of outputs as described below:

Examples

Go back to the main list of commands