Zip archives bundle multiple files and directories into a single compressed file, making downloads, backups, and transfers more efficient on Linux systems. Extracting these archives restores the original layout so configuration files, logs, and application payloads become usable again.
On most Linux distributions, the unzip utility reads .zip metadata, recreates directory hierarchies, and writes decompressed data to the chosen destination. File permissions, relative paths, and timestamps are preserved where possible, so extracted content behaves similarly to the source tree that was archived.
Extraction should account for target locations such as /home, /opt, or shared mounts, as insufficient permissions or unexpected overwrite prompts can interrupt the process. Archives may also contain many files or password-protected entries, so previewing contents and controlling overwrite behavior reduces the risk of clutter, data loss, or accidental extraction into sensitive directories.
$ cd /root/sg-work/unzip-demo $ ls output_filename.zip secret_archive.zip
Replace /path/to/directory with the path that contains the .zip file.
$ unzip -l output_filename.zip
Archive: output_filename.zip
Length Date Time Name
--------- ---------- ----- ----
4 2026-01-11 05:09 file1.txt
4 2026-01-11 05:09 file2.txt
0 2026-01-11 05:09 folder1/
--------- -------
8 3 files
The -l option shows file names and sizes so the archive can be inspected before extraction.
$ unzip output_filename.zip Archive: output_filename.zip extracting: file1.txt extracting: file2.txt creating: folder1/
Replace output_filename.zip with the actual archive name to unpack its contents.
$ unzip output_filename.zip -d /root/sg-work/unzip-demo/extract Archive: output_filename.zip extracting: /root/sg-work/unzip-demo/extract/file1.txt extracting: /root/sg-work/unzip-demo/extract/file2.txt creating: /root/sg-work/unzip-demo/extract/folder1/
Replace /path/to/extract with the desired target directory for the extracted files.
$ unzip -n output_filename.zip Archive: output_filename.zip
The -n option skips files that already exist, which protects newer local copies from being replaced.
$ unzip -P s3cr3t secret_archive.zip Archive: secret_archive.zip extracting: secret.txt
Passing passwords with the -P option exposes them in shell history and process listings; use interactive prompts instead whenever possible.
$ ls -lh /root/sg-work/unzip-demo/extract total 12K -rw-r--r-- 1 root root 4 Jan 11 05:09 file1.txt -rw-r--r-- 1 root root 4 Jan 11 05:09 file2.txt drwxr-xr-x 2 root root 4.0K Jan 11 05:09 folder1
The presence of the expected files and directories confirms a successful extraction.