<tutorialjinni.com/>

Linux ZIP Command Example

Posted Under: Linux, Shell, Snippets, Zip on Feb 16, 2021
Various command snippets for to create a Zip in Linux. To use Zip command you need to install it first if system do not have it.

Install Zip on Ubuntu/Debain

sudo apt install zip

Install Zip on CentOS 8

sudo dnf install zip

Simple Zip Command

zip compress.zip file1 file2 file3

Zip Folder Command

zip -r compress.zip folder/

Add Files to Existing Zip file

zip -u compress.zip MoreFiles

Zip and Encrypt file

zip -e compress.zip files1 file2 folder
for folder -r switch is required too.

Zip Exclude Directory

zip -r compress.zip -x  "PATH/TO/EXCLUDE/FOLDER/*" "PATH/TO/ANOTHER/EXCLUDE/FOLDER/*"  


imgae