how to zip file linux code example

Example 1: linux zip a directory

zip -r filename.zip /path/to/folder1

Example 2: convert all files and folders in current directory into zip in linux

zip -r myfiles.zip mydir

Example 3: create a zip file in linux

Zipping a folder in linux
zip -r tecmint_files.zip tecmint_files

Unzipping a Zip file in linux
unzip tecmint_files.zip

Example 4: zip some files linux

zip archivename.zip filename1 filename2 filename3

Example 5: how to install zip file in linux

$ sudo apt install zip