Back to Blog
Server
June 1, 2026
Fahim Hossain

Zipping and Unzipping using Terminal

How to zip and unzip files straight from the terminal, including installing the zip tool on Linux when it is not already there.

A terminal window with a zipped folder, illustrating zipping and unzipping files from the terminal

In order to “unzip” a file using terminal, make sure you have the application installed on your system.

Zipping files using the terminal

Installing zip Application

To install “zip” on CentOS issue the following command in your terminal

sudo yum install zip

To install “zip” on Ubuntu issue the following command in your terminal –

sudo apt-get install zip

Using the zip Application

Now if you want to simply zip a file/folder, you can use the following command –

zip -r zippedFileName.zip foldertozip

Unzipping files using the terminal

Installing unzip Application

To install “unzip” on CentOS issue the following command in your terminal

sudo yum install unzip

To install “unzip” on Ubuntu issue the following command in your terminal –

sudo apt-get install unzip

Using the unzip Application

Now if you want to extract a file to a particular destination folder, you can use the following command –

unzip filetounzip.zip -d path_to_destination_folder

If you want to extract the file in its current location then you can issue the following command –

unzip filetounzip.zip

Running infrastructure like this in production? ARITS does managed infrastructure and DevOps so your team can ship without babysitting servers.

Have a project you want built right?

Tell us the scope and your deadline. You will get a straight read on what it takes to build, and what it will cost, from a team that has shipped 400+ projects out of Dhaka and London.