---
title: "zip and unzip Commands &#8211; Basic Archiving"
description: "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. Create an archive Extract Files List Archived..."
url: https://www.inmotionhosting.com/support/website/zip-and-unzip-commands-basic-archiving/
date: 2019-10-29
modified: 2024-01-03
author: "InMotion Hosting Contributor"
categories: ["Linux", "Website"]
type: post
lang: en
---

# zip and unzip Commands &#8211; Basic Archiving

Learn how to create, extract, and list files within a compressed zip archive in [Secure Shell (SSH)](/support/server/ssh/do-you-provide-ssh-access/), or cPanel Terminal, with the `zip` and `unzip` commands.

- [Create an archive](#compress)
- [Extract Files](#decompress)
- [List Archived Files](#list)

Spend more time working on your website than setup with our [Shared Hosting](https://www.inmotionhosting.com/shared-hosting) – Softaculous Instant Installer and WP-CLI ready to go.

## Compress Files

Use the `zip` command to manage compressed files.

```
zip -r archive-name.zip path-to-directory-or-files
```

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

Used options:

`-r` – Travel the directory structure recursively

## Decompress Files

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

```
unzip archive.zip
```

Example: `unzip images.zip`

### Extract to Another Directory

```
unzip archive.zip -d another-folder
```

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

Used options:

`-d` – Specify directory

## List Files

```
unzip -l archive.zip
```

Used options:

`-l` – list archived files

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