How to zip a file in Ubuntu

Try:

sudo apt-get install zip -y
zip -r folder.zip folder

The -r flag will tell it to be recursive, which may be needed for a directory.


If zip command is not working then you need to install zip first. Here is the command which will install zip, gzip and tar.

sudo apt-get install zip gzip tar

then you can zip, gzip or tar. zip the folder :

zip -r myzipped.zip my_folder

Here -r means recurrsive.

Here are some more related useful commands :

unzip myzipped.zip
tar -cvzf my.tar.gz directory_name
tar -xvzf myzipped.tar.gz

Tags:

Zip