zip and unzip Commands – Basic Archiving

Learn how to create, extract, and list files within a compressed zip archive in Secure Shell (SSH), or cPanel Terminal, with the zip and unzip commands.

Spend more time working on your website than setup with our Shared Business Hosting – Softaculous Instant Installer and WP-CLI ready to go.

Compress Files

Use the zip command to manage compressed files.

zip -r path-to-directory-or-files

Example: zip -r *.png – Archive all PNG image files in the current directory into a file Example: zip -r * – Archive all files and folders in the current directory into a file

Used options:

-r – Travel the directory structure recursively

Decompress Files

Instead of zip, use the unzip command to manage compressed files.


Example: unzip

Extract to Another Directory

unzip -d another-folder

Example: unzip -C restored – Extract files from the file into the existing /restored folder

Used options:

-d – Specify directory

List Files

unzip -l

Used options:

-l – list archived files

For more options, type the zip --help or unzip --help command.

InMotion Hosting Contributor
InMotion Hosting Contributor Content Writer

InMotion Hosting contributors are highly knowledgeable individuals who create relevant content on new trends and troubleshooting techniques to help you achieve your online goals!

More Articles by InMotion Hosting

Was this article helpful? Join the conversation!

Shop the Black Friday Sale
Hurry! These Deals Won't Last Long