How to Zip and Unzip Files in Ubuntu 22.04 LTS Linux

How to Zip and Unzip Files in Ubuntu 22.04 LTS Linux

Posted on

Study the instructions to put in Zip and Unzip in Ubuntu 22.04 LTS Jammy JellyFish to extract the compressed recordsdata and folders archived in a ZIP format.

This tutorial will assist the customers to be taught the command to ZIP and unzip in Ubuntu Terminal. Zip is a command Archive format that can be utilized on nearly all working programs to make use of, particularly on Home windows. Nevertheless, all Linux distros don’t have a device to extract the Zip format recordsdata by default, for instance, Ubuntu (particularly the minimal set up). In reminiscent of case we manually have to put in a command line device to extract our recordsdata.

Steps to put in and use Zip or Unzip in Ubuntu 22.04

1. Replace Ubuntu 22.04

The Archive supervisor we’re about to put in is on the market via the default system repository and APT bundle supervisor. Subsequently, earlier than going additional, let’s first run the system replace command:

sudo apt replace && sudo apt improve -y

2. Set up ZIP & Unzip on Ubuntu 22.04 Linux

To create or unpack Zip archives below Ubuntu 22.04 Linux, you could first be certain that the required device is on the market on the system. Though, usually ZIP and unzip instruments come pre-installed nevertheless, if not then use the below-given command:

sudo apt set up zip unzip

2. Zip Linux Command Syntax

Subsequent, we must always know what are choices out there to make use of with ZIP or Unzip Instructions. Right here is the Checklist of the widespread ones together with their utilization syntax.

zip [-options] [-b path] [-t mmddyyyy] [-n suffixes] [zipfile list] [-xi list]

The default motion is so as to add or substitute zipfile entries from record, which 
can embrace the particular identify - to compress commonplace enter.
If zipfile and record are omitted, zip compresses stdin to stdout.

# Listed here are the choices that we are able to use with the ZIP commands-

-f freshen: solely modified recordsdata      -u replace: solely modified or new recordsdata
-d delete entries in zipfile        -m transfer into zipfile (delete OS recordsdata)
-r recurse into directories         -j junk (do not report) listing names
-0 retailer solely                       -l convert LF to CR LF (-ll CR LF to LF)
-1 compress quicker                  -9 compress higher
-q quiet operation                  -v verbose operation/print model data
-c add one-line feedback            -z add zipfile remark
[email protected] learn names from stdin            -o make zipfile as outdated as newest entry
-x exclude the next names      -i embrace solely the next names
-F repair zipfile (-FF strive tougher)     -D don't add listing entries
-A modify self-extracting exe       -J junk zipfile prefix (unzipsfx)
-T take a look at zipfile integrity           -X eXclude eXtra file attributes
-y retailer symbolic hyperlinks because the hyperlink as an alternative of the referenced file
-e encrypt                          -n do not compress these suffixes
-h2 present extra assist

Let’s see some widespread instructions that may assist us to make use of this device for extracting archive recordsdata and repacking those we would like.

3. Tips on how to Zip a file or folder in Ubuntu 22.04

The syntax of the ZIP instructions will at all times be the identical even for Ubuntu and different Linux distros.

zip choices recordsdata and folders record

If the archive already exists, the recordsdata and folders are added to the archive or up to date. The archive isn’t going to get replaced.

Add particular person recordsdata to an archive:

zip file1 file2 (...)

With this command, an archive “” with the recordsdata “file1” and “file2” is created or up to date within the present listing.

So as to add a folder to an archive:

zip -r folder1 folder2 (...)

This command creates an archive “” with the folders “folder1” and “folder2” together with all subfolders and recordsdata within the present listing.

Create a Zip archive and delete the unique recordsdata

With creating of Archive file you need to take away the unique recordsdata or folders which were used to create the ZIP archive file of yours, then use -m possibility. It’s meant to maneuver recordsdata completely relatively than copying them to the archive.


zip -m file1 file2

4. Removes/Delete folders and/or recordsdata from the Zip archive 

zip -d file1 file2 folder / * (...)

The command removes the recordsdata “file1” and “file2” in addition to the folder “folder” & its contents from the archive “”

Present extra choices:

zip -h2

Shows full assist with all out there choices.

5. Show the contents of the zip file on Ubuntu 

unzip -l

This command reveals the entire content material of the archive “”

6. Password-protected Linux ZIP file

Many occasions, we want safety for delicate recordsdata or information whereas archiving them. Thus, if you wish to create a Linux zip with a password then merely use -e possibility. With this, we are able to considerably enhance the safety of our zipped recordsdata.

zip -e file1 file2

As you employ -e parameter, the system will ask you to create a password for the recordsdata by getting into it two occasions.

7. Unzip a file or folder on Ubuntu 22.04

After you have discovered the way in which to place your recordsdata and folder in a ZIP format archive on Ubuntu. Let’s see the way in which to extract the content material of an current ZIP file.

Unpack the entire archive:


Unpacks the entire archive into the present listing.

Extract the archive to a selected location:

unzip -d /tmp/goal

Extract the entire archive to “/tmp/goal”

Extract solely sure recordsdata or folders:

unzip file1 folder1 file2 -d /tmp/goal

-d stands for the listing.

Present extra choices:

unzip -hh

Shows full assist with all out there choices.

unzipsfx choices:
-c, -p - Output to pipe. (See above for unzip.)
-f, -u - Freshen and Replace, as for unzip.
-t - Take a look at embedded archive. (Can be utilized to record contents.)
-z - Print archive remark. (See unzip above.)

unzipsfx modifiers:
Most unzip modifiers are supported. These embrace
-a - Convert textual content recordsdata.
-n - By no means overwrite.
-o - Overwrite with out prompting.
-q - Quiet operation.
-C - Match names case-insensitively.
-j - Junk paths.
-V - Hold model numbers.
-s - Convert areas to underscores.
-$ - Restore quantity label.

8. Uninstall Zip & Unzip from Ubuntu 22.04

After a while when you don’t need this Archive supervisor in your Linux then right here is the command to utterly take away Zip & Unzip out of your Ubuntu 22.04 together with their dependencies.

sudo apt autoremove --purge unzip zip

Ending word:

These had been a couple of widespread ZIP and Unzip instructions that we are able to use on Ubuntu 22.04 Linux working system for packaging or unpacking archive recordsdata utilizing the terminal.

Different Articles:

How to install p7Zip GUI on Ubuntu 20.04 LTS
How to install GitEye GUI Git client on Ubuntu 22.04 | 20.04 LTS
Install p7Zip GUI on Ubuntu 22.04 LTS Jammy Linux
How to Edit Files as Root in Ubuntu using GUI File Manager

offshore vps