How to Use CentOS Unzip

29/12/2020
Zip is a file compression utility. It is the default file compression utility on Windows and widely used in Windows operating system. The Zip compressed files are also called zip files. The best thing about Zip is that it is cross platform. Zip files can be opened in Mac OS, Windows and Linux. You can also create Zip files from Mac OS, Windows, and Linux and open it in other operating systems.

On Linux based operating systems such as CentOS, the unzip command is used to open Zip files.

In this article I will show you how to use the unzip command to open Zip files on CentOS. I am going to use CentOS 7 for the demonstration. Let’s get started.

Installing unzip on CentOS 7:

On CentOS 7, the unzip package may not be installed by default. But it is available in the official package repository of CentOS 7. So it is very easy to install.

First update the YUM package repository cache with the following command:

$ sudo yum makecache

The YUM package repository cache should be updated.

Now install unzip with the following command:

$ sudo yum install unzip

Now press y and then press <Enter> to continue.

unzip should be installed.

Now to check whether unzip works, run the following command:

$ unzip -v

As you can see, unzip is working perfectly.

Working with Zip Files Using Graphical User Interface:

If you have graphical desktop environment such as GNOME desktop environment installed on your CentOS operating system, then working with Zip files is pretty easy.

As you can see, I have app.zip file in the ~/Downloads directory of my HOME directory.

Now if you right click on the zip file, you should be able to see the following options. The first option is Open With Archive Manager. If you double click on a Zip file, it will open with the Archive Manager by default.

You can also click on Extract Here to extract the zip file.

As you can see, the zip file is opened in the Archive Manager and I can see all the contents of the Zip file.

From the Archive Manager, you can click on Extract to extract the contents of the Zip file.

You should see the following window. You can click on the Extract button to extract the Zip file in the current directory. If you wish, you can create a new folder and extract the contents of the Zip file there.

I create a new directory myapp/ and extracted the contents of the Zip file there.

As you can see, the contents of the Zip file are correctly extracted into the myapp/ directory.

You can also select specific files and folders from the Archive Manager and drag and drop them on a directory. Only your desired files and folders will be extracted.

Listing the Contents of the Zip file using unzip Command:

You can list all the files and directories stored inside a Zip file with the following command:

$ unzip -l app.zip

As you can see, all the contents of the Zip archive app.zip is listed.

Extracting a Zip File using unzip Command:

You can extract a Zip file using the unzip command very easily.

To extract a Zip file into the current directory where the zip file is, run the following command:

$ unzip app.zip

NOTE: Here app.zip is the Zip file that I am extracting.

The contents of the Zip file should be extracted to your current working directory.

As you can see, all the files and directories of app.zip is extracted.

In the earlier example, all the files were extracted in the current directory. You may want to extract the contents of the Zip file to any specific directory. You can also do that with the unzip command.

First create the directory where you will be extracting the Zip file with the following command:

$ mkdir ~/Downloads/myapp

Now run the following command to extract the Zip file app.zip into the

~/Downloads/myapp directory:
$ unzip app.zip -d ~/Downloads/myapp

The contents of the app.zip file is extracted into the ~/Downloads/myapp directory as you can see in the screenshot below.

The ls command also verifies that the Zip file was extracted in the desired directory.

Extracting Specific Files from the Zip File using unzip Command:

You can also extract specific files and directories from the Zip file using unzip command.

For example, let’s say you want to extract only server.js file from app.zip file, run the following command:

$ unzip app.zip server.js

server.js should be extracted.

As you can see, only server.js was extracted to the current working directory.

You can also specify a directory where the files and directories should be extracted as follows:

$ unzip app.zip server.js d ~/Downloads/myapp

You can also extract a specific subdirectory from the Zip file as follows:

$ unzip app.zip ‘models/*’ -d ~/Downloads/mypp

 

As you can see the directory models/ and all the contents of the directory was extracted into the ~/Downloads/myapp directory.

That’s how you use Unzip on CentOS. Thanks for reading this article.

ONET IDC thành lập vào năm 2012, là công ty chuyên nghiệp tại Việt Nam trong lĩnh vực cung cấp dịch vụ Hosting, VPS, máy chủ vật lý, dịch vụ Firewall Anti DDoS, SSL… Với 10 năm xây dựng và phát triển, ứng dụng nhiều công nghệ hiện đại, ONET IDC đã giúp hàng ngàn khách hàng tin tưởng lựa chọn, mang lại sự ổn định tuyệt đối cho website của khách hàng để thúc đẩy việc kinh doanh đạt được hiệu quả và thành công.
Bài viết liên quan

Thuê Proxy chạy Google Ads / Cần chú ý gì khi chọn proxy và email chạy G.G ads?

Cần chú ý gì khi chọn proxy và email chạy G.G ads? So với các anh em chạy ads trên FB thì ads thủ G.G...
12/10/2023

Install 7Zip Compression Tool on Ubuntu

How to Install 7-zip on Ubuntu and use it to compress and decompress any file or folder When you want to transfer large...
28/12/2020

Cách Nuôi account Ebay mới nhất 2021

Chào anh em hôm nay mình xin chia sẻ cách nuôi tài khoản Ebay hiệu quả vừa tạo một cách hiệu quả...
14/01/2021
Bài Viết

Bài Viết Mới Cập Nhật

Dịch vụ thuê mua proxy US UK uy tín, chất lượng số #1
13/05/2024

Thuê mua proxy Việt Nam: Báo giá & các thông tin MỚI NHẤT
13/05/2024

Dịch vụ thuê mua proxy giá rẻ an toàn, tốc độ cao
13/05/2024

Thuê mua proxy V6 uy tín, chất lượng tại đâu?
11/05/2024

Thuê mua proxy Tiktok tăng doanh thu, hiệu quả cao
11/05/2024