How to zip unzip folder ubuntu command?

How to zip files or folders using command?

Before doing zip or unzip a folder or files, you will need to install zip using below command if it is not already install:

$ sudo apt install zip unzip

Now you can use below syntaxes to create a zip of folders/files:

zip -r name.zip folder
zip -r name.zip folder1 folder2
zip -r name.zip /path/to/folder1 /path/to/file2

After running the command you will get a zipped file which you can keep as a back up etc.

To unzip a file use below command:

$ unzip zipfilename.zip