Back to the command reference

zip

ArchivesBeginnerReference only

Create .zip archives

Name: zip: ZIP format

This command is outside what the site lets you practise (mostly distribution-specific or rarely used tools). This page describes how to use it; try it on your own Linux system.

Description

zip creates .zip archives holding many files and directories (-r). ZIP opens natively on Windows and macOS, so it suits exchanging files with users of other systems.

Syntax

zip [OPTION]... ARCHIVE FILE...

Common options

-rRecurse into directories
-x PATTERNLeave out matching files, e.g. -x "*.git*"
-jStore just the files, not their directories
-uAdd only new or changed files
-dDelete files from the zip
-mDelete the originals after zipping
-9Best compression
-eEncrypt with a password
-qQuiet

Examples

  • $ zip -r site.zip site/

    Zip a directory

    Explain
  • $ zip report.zip report.pdf data.csv

    Zip several files

    Explain

Related