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

How to Unzip a File in LinuxFile 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 the file in Red Hat Linux Enterprise 6 (RHEL 6). 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 files 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
[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 simple steps on how to unzip a file in Linux give you some basic idea how do zip and unzip.