This page looks best with JavaScript enabled

How to work with ZIP archives on GNU/Linux

 ·  ☕ 1 min read

ZIP is a popular archive file format that supports lossless data compression. A .zip file may contain one or more files or directories. zip utility is used to compress file(s) and unzip to extract.


  • Create a .zip archive from file(s):

    zip file1 file2

    Use -m to delete source file(s).
    Use -r to compress folder(s).
    Use -e to encrypt archive.

  • Create a .zip archive from file, while specifying the compression level (1 being worst, 9 best, and 6 default). For example, level 7:

    zip -7 file1
  • Extract file(s) from archive:

  • Extract file(s) to specific directory:

    unzip -d /home/$USER/Documents
  • Extract file(s) from archive to stdout:

    unzip -p
  • List all files in

    unzip -l

    Use -v for verbose output.

  • Add file(s) to archive:

    zip -u file3 file4
  • Remove file(s) from archive:

    zip -d file4
  • Test compressed archive data:

    unzip -t

All Options

You can find all zip and unzip options in man pages:

man zip
man unzip
What's on this Page