Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to zip a file in Ubuntu

Tags:

zip

People also ask

How do I zip a file in Linux?

The easiest way to zip a folder on Linux is to use the “zip” command with the “-r” option and specify the file of your archive as well as the folders to be added to your zip file. You can also specify multiple folders if you want to have multiple directories compressed in your zip file.

How do I zip a file in terminal?

If you open a terminal console in the parent directory, or used the cd command to navigate there from the command line, you should then be able to run the command on the folder. The syntax is ' zip -r <zip file name> <directory name> '. The '-r' option tells zip to include files/folders in sub-directories.

Does Ubuntu have zip?

There is a default . zip extractor for ubuntu. Its name is "archive manager." To zip the files (the appropriate word is to compress) just right click on the file/folder and select compress.


Try 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

check out solution below: You can create a simple zip file with zip command without using any options.

For example to create a zip file of text files first_file.txt, second_file.txt and third_file.txt run below command:

sudo zip newfile.zip first_file.txt second_file.txt third_file.txt

The output should be:

adding: first_file.txt
adding: second_file.txt
adding: third_file.txt

for more information visit


Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!