How to Zip and Unzip a File in Ubuntu & Other Linux From Command Line

In this article, you learn to zip and unzip command in Ubuntu Terminal. How to zip and unzip a file and folder in Ubuntu & other Linux from Command Line. Terminal is very frequently searched question. Both zip and unzip package contains programs to create a compressed file in Linux. However, these packages not installed by default in Ubuntu. However, you can install both of these package using the Ubuntu terminal. So let’s start, zip and unzip command in ubuntu terminal.

In Ubuntu, several utilities are available for compress files and folders and extracting compressed files. However, we recommended to use “zip” and “unzip” utility.

Why we need zip and unzip utilities in Linux terminal?

It can take a lot of time to upload and download files and folders from the server to a local and a local to the server. However, we can do this process bit faster to transfer compressed files instead of transferring multiple files. Moreover, FTP clients do not support to allow compression and decompression of files.

How to zip a File or Folder in Ubuntu Linux from Linux Command Line

First you have to install zip in Ubuntu using the following command,

$ sudo apt-get install zip

After installing the zip utility, you can create zip file using the following command,

$ zip -r compressed_filename.zip folder_name

How to Unzip a File From in Ubuntu Linux from Command Line

You have to install unzip in Ubuntu using the following command,

$ sudo apt-get install unzip

After installing the unzip utility, you can extract to a particular destination folder using the following command,

$ unzip compressed_filename.zip -d destination_folder

Here you can go to find more about zip and unzip Ubuntu package. You can explore here other Ubuntu Linux related posts.

If you like our article, please consider buying a coffee for us.
Thanks for your support!

Support us on Buy me a coffee! Buy me a coffee!



2 Responses Leave a Comment

  1. Nice post with clear instruction. I really liked it.

  2. A powerful tool is 7z, which zips and unzips a range of compression format.

    First, Installs 7z
    sudo apt-get install p7zip-full

    This command to make lists of content of the zip:
    7z l zipfile.zip

    This command extracts the contents of the zip:
    7z x zipfile.zip

Join the Discussion.