---
layout: page
category-page: fs
category-title: FileSystem
tags: compress file directory extract
author: Joao Tomazoni
title: zip
previous-page: pages/fs/rm.html
---
zip
is the command to package and compress files together as .zip extension.
Simply type zip + name of the zip file + name of the files to be compressed as .zip.
zip -r [target.zip] [source1] [source2]Say you want to compress a file named test.txt and an image named image.png together in one zip file named test.zip. This is what it should look like:
zip -r test.zip text.txt image.pngIn this case it should return a test.zip file in your desktop with a directory inside containing the two files together.
zip -e test.zip text.txt image.png Enter password: (password required to unzip the file)
zip -u test.zip newtext.txtThe newtext.txt file will be added to the current test.zip file.
zip -d test.zip newtext.txtThe newtext.txt file will be removed from the current test.zip file.