top of page

How to Use Unzip in Linux

  • Writer: HolyHosting
    HolyHosting
  • Oct 30
  • 3 min read

Compressing and decompressing files simplifies many complex tasks — like file transfers! In this tutorial, you’ll learn how to use unzip with Linux commands to improve your workflow on a VPS.

Zip is a popular compression tool that’s portable and easy to use — you can even unzip files created on Linux in Windows!

Unzip is a utility that isn’t installed by default on most Linux distributions, but it can be easily added. You can also pair it with .tar.gz compression by creating .zip archives!

ree

What Is Zip Used For?

  • When working frequently between Windows and Unix-based systems. It not only compresses files but also serves as an archive utility compatible with multiple operating systems.

  • To save bandwidth. If you have limited or restricted bandwidth, you can use zip between two servers to transfer files efficiently.

  • To transfer files faster — zip reduces file size and therefore transfer time.

  • To upload or download directories more quickly.

  • To save disk space.

  • To unzip password-protected .zip files.

  • To enjoy a solid compression ratio.

Before using unzip in Linux, make sure you can access your VPS via SSH.


How to Install Unzip

Now that you know what zip is used for, let’s go over how to install unzip on your Linux VPS depending on your operating system.


Install Unzip on Debian and Ubuntu

Installing unzip is simple! On Ubuntu or Debian, use:

sudo apt install unzip

Wait a moment for the installation to complete.

To create zip archives, you’ll also need to install zip:

sudo apt-get install zip

Install Unzip on CentOS and Fedora

This is just as easy. Run:

sudo yum install unzip

After installation, verify the path with:

which unzip

You should see output similar to:

/usr/bin/unzip

To confirm that unzip is correctly installed, check its version:

unzip -v

How to Use Zip and Unzip in Linux

Now that the utilities are installed, let’s go over their basic usage.


Create Zip Files in Linux

The basic syntax for creating a .zip file is:

zip options zip_file file_list

For example, to compress two files (ExampleFile.txt and ExampleFile1.txt) into sampleZipFile.zip:

zip sampleZipFile.zip ExampleFile.txt ExampleFile1.txt

Unzip a File in Linux

The unzip command can be used without any options to extract all files into the current directory:

unzip sampleZipFile.zip

By default, files are extracted into the current folder if you have read/write permissions.


Remove a File from a .zip Archive

To delete a file (e.g., ExampleFile.txt) from an existing archive:

zip -d sampleZipFile.zip ExampleFile.txt

After running it, unzip the archive again and you’ll see that ExampleFile.txt has been removed.


Update a Zip Archive

To add a new file (e.g., ExampleFile2.txt) to an existing archive:

zip -u sampleZipFile.zip ExampleFile2.txt

Now, when you unzip sampleZipFile.zip, the new file will be included.


Move a File into a Zip (and Delete the Original)

You can move files into a zip file and remove them from their original location using the -m option:

zip -m sampleZipFile.zip ExampleFile2.txt

Zip Recursively in Linux

Use the -r option to compress directories recursively:

zip -r sampleZipFile.zip MyDirectory

This includes all files and subdirectories inside MyDirectory.


Exclude Files When Creating a Zip

Exclude unwanted files using the -x option:

zip -x sampleZipFile.zip ExampleFile.txt

This prevents ExampleFile.txt from being added.


Unzip to a Different Directory

To extract files to a specific directory instead of the current one:

unzip sampleZipFile.zip -d /usr/sampleZip/ExampleDir

Unzip Multiple Zip Files at Once

To extract all zip files in the current directory:

unzip '*.zip'

Suppress Output When Using Unzip

To hide extraction details and messages, use the -q option:

unzip -q sampleZipFile.zip

Exclude Files When Unzipping

To extract all files except one:

unzip sampleZipFile.zip -x excludedFile.txt

Or exclude specific file types, such as PNGs:

unzip sampleZipFile.zip -x "*.png/*"

Unzip Password-Protected Files

To extract a password-protected .zip file, use the -P option:

unzip -P Password sampleZipFile.zip

Replace Password with the actual password for the archive.

Overwrite Files When Unzipping

If you unzip a file in the same location and are prompted to overwrite, you can automatically overwrite all existing files using -o:

unzip -o sampleZipFile.zip
⚠️ Use caution — this will replace all existing copies.

Unzip Without Overwriting Existing Files

To extract only files that don’t already exist, use the -n option:

unzip -n sampleZipFile.zip

List Zip File Contents

To list all files in a .zip archive without extracting them:

unzip -l sampleZipFile.zip

Conclusion

We hope this guide has been helpful! 🚀 Remember, don’t hesitate to ask questions on the HolyHosting Discord or contact our support team.

Follow us on Twitter @HolyHosting to stay up to date.

ree

Stuffy @ HolyHosting

 
 

Related Posts

See All
How to Fix the "Mismatched Mod Channels" Error

Hello, HolyHosting players! 🌟We know that playing on modded servers is super fun, but it can also be a headache 🧠 when your mods don’t match between your game and the server. 😩 Here’s how to fix th

 
 

CREATE YOUR SERVER

READY TO GET STARTED?

Start today and we’ll offer you a 25% discount on your first bill with our new customer promotion!

Etiqueta.png
View active promotions and coupons
holyhosting logo

Powerful servers at affordable prices.

HolyHosting

Copyright © 2025 HOLY SERVERS LLC, operating under the name HolyHosting.

REG. NO.: 001599788. This business entity is officially registered at 30 N Gould St, Suite N, Sheridan, WY 82801, Wyoming, US.

  • X
  • Instagram
  • Facebook
  • Discordia
  • YouTube
  • Tik Tok

POPULAR

US

SUPPORT

Minecraft
Minecraft Dedicated Hosting
Discord Bot Hosting
Other Games Hosting
Voice Server Hosting
MC Servers Panel
Games Servers Panel

About Us
Client Area
Branding
Payment Methods
Hardware by Location
Terms and Conditions
Privacy Policies
Refund Policies

Create a Ticket
Knowledge Base
Discord
Network Status
Request Affiliation

dmca

Copyright © 2025 HOLY SERVERS LLC, operating under the registered name HolyHosting. All rights reserved.

The payment process may be handled by Tebex Limited, acting as the registered merchant and being responsible for product fulfillment and handling billing inquiries.

bottom of page