A terminal window with a zipped folder, illustrating zipping and unzipping files from the terminal
Back to Blog
DevOps & Infrastructure
February 7, 2020
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.

Need extra engineers, or a team to run the build?

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

Cookies

We use cookies to see how people find this site and to measure our ads. You can turn those off — everything here still works. Privacy policy

Necessary

Keeps the site working and remembers this choice.

Always on

Analytics

Anonymous stats on which pages get read, so we know what to write next.

Marketing

Lets us measure which ads brought someone here.