Unzip Files in Linux


In Windows you might have come across a utility such as WinZip for uncompressing files . But in Linux you can do it 2 ways , from command line and using the GUI ( Graphical User Interface) .

Steps

Graphical Method

  1. If you are using GNOME, you could use File roller, which is the default archive manager and it lets you zip and unzip archives graphically.
  2. If you are on KDE ,try using ark or Karchive.

Command Line

  1. Install zip and unzip tools. Linux has both zip and unzip programs. But in most linux distributions these utilities are not installed by default. To install go to a command prompt, such as a terminal and follow the instructions below.
  2. If you are using Debian Based linux distributions , after becoming root user,type the two commands to install zip and unzip program.
    apt-get install zip
    apt-get install unzip.
  3. If you are Red Hat Linux/Fedora user then you can use yum command to install zip and unzip program.
    yum install zip unzip.

Zipping a file

  1. Navigate to directory which you wish to compress and type in
    zip data *
    Replace the the data with a title for your zip file.
  2. If you wish to zip up an entire directory , navigate to your directory and use the following command.
    zip -r data *.

Unzipping an archive file

  1. Unzip is used to extract all the files of a zip archive to your current directory .
    unzip data.zip.
  2. You could also test the .zip file ( ie make sure its ok or not) by the following command .The command prints a summary message indicating whether it is usable or broken.
    unzip -tq data.zip.
  3. To extract an individual file from a zip archive: (Let us suppose the name of the file as wiki.txt)
    unzip data.zip wiki.txt.
  4. Extract all files of the zip into the /tmp directory.
    unzip data.zip -d /tmp.
  5. List the files of the archive without unzipping them.
    unzip -l data.zip

Tips

  • There are other graphical archive managers such as x archive, squeeze etc which may be available in your repos.

Related Articles