How to Unzip a File in Linux RHEL 6/CentOS 6/CentOS 7

How to Unzip a File in Linux

File compression can be done in a variety of methods on Linux systems. In Windows you might have come across a utility such as WinZip or Winrar for uncompressing files.

But in Linux you can do it two ways, from Graphical User Interface (GUI) and command line.

As linux system administrator most of the routine task playing with the linux command line. It is quite difficult to remember all the command that have been in use.

In this post, I will show the simple steps on how to unzip a file in Linux and how to zip a folder in Linux Red Hat Linux Enterprise 6 (RHEL 6).

See also  How to Start, Stop and Restart 389 Directory Server on CentOS 6.2

This steps may also working on other versions such as CentOS 5.1, CentOS 5.2, CentOS 5.3, CentOS 5.4, CentOS 5.5, CentOS 5.6, CentOS 5.7, CentOS 6.x, RHEL 5.x and RHEL 6.x. CentOS 7 and Oracle Linux 7.

zip is a compression and file packaging utility for Unix, VMS, MSDOS, OS/2, Windows, Macintosh and linux operating systems. Meanwhile, unzip is utility to extract compressed files from a ZIP archive.

How to zip a folder in Linux

1. Creates the archive and puts all the files in the current directory in it in compressed form as below :

[root@rhel6 ~]# touch file1
[root@rhel6 ~]# touch file2
[root@rhel6 ~]# touch file3
[root@rhel6 ~]# ls
file1  file2  file3

Then zip folder1 :

[root@rhel6 ~]# zip folder1 *
  adding: file1 (stored 0%)
  adding: file2 (stored 0%)
  adding: file3 (stored 0%)
[root@rhel6 ~]# ls
file1  file2  file3

How to Unzip a File in Linux

2. To unzip into /var/www/html/joomla253 folder :

[root@rhel6 ~]# unzip -d /var/www/html/joomla253

I hope the following tutorial on how to unzip a file in Linux will give you some basic idea on how to zip and unzip a folder on Linux.


Leave a Reply

Your email address will not be published. Required fields are marked *