About nixCraft

Topics

Zipping and Unzipping Files under Linux

Posted by Vivek Gite [Last updated: July 10, 2007]

Asked by Yamir

Q. Windows has winzip program what about Linux; I cannot find anything under Application menu. I am using Debian Linux distribution. How do I zip and unzip file under Linux?

A. Linux has both zip and unzip program. By default, these utilities not installed (see Linux winzip like GUI tools/utilities below). To install them from shell prompt (open shell prompt by clicking on Application > System Tools > Terminal ). You must be a root user, Type following two commands to install zip and unzip program:

# apt-get install zip
# apt-get install unzip

If you are Red Hat Linux/Fedora user then you can use yum command to install zip and unzip program:

# yum install zip
# yum install unzip

zip examples:
Creates the archive data.zip and puts all the files in the current directory in it in compressed form

$ zip data *

No need to add .zip extension or suffix as it is added automatically by zip command.

To zip up an entire directory (including all subdirectories), the command:

$  zip -r data *

unzip example:
To use unzip to extract all files of the archive pics.zip into the current directory & subdirectories:

$ unzip  pics.zip

You can also test pics.zip, printing only a summary message indicating whether the archive is OK or not:

$ unzip -tq pics.zip

To extract the file called cv.doc from pics.zip:

$ unzip pics.zip  cv.doc

To extract all files into the /tmp directory:

$ unzip pics.zip  -d /tmp

To list all files from pics.zip:

$ unzip -l pics.zip

Linux GUI packages like Winzip:
You can use graphics packages

* KDE Desktop: Ark is an Archive Manager for the KDE Desktop. You can start Ark from Application > Accessories.

* GNOME Desktop: File Roller ia an Archive Manager for the GNOME Desktop.

For more information please consult following resources:

Tell us how we're doing: Please answer a few questions about your experience to help us improve nixCraft.

You may also be interested in other helpful articles:

Discussion on This Article:

  1. anol Says:

    I have tried the command that specified, but here it won’t work(am using linux suse 8.2′ ), can you please clarify why it’s not working?

  2. nixcraft Says:

    You must install zip and unzip commands. Use yast or rpm command to install these programs.

  3. michel Says:

    thank man very useful for a non-developer type of guy like me.

    Michel

Leave a Reply

We encourage your comments, and suggestions. But please stay on topic, be polite, and avoid spam. Thank you very much for stopping by our site!

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

*
To prove you're a person (not a spam script), type the security word shown in the picture. Click on the picture to hear an audio file of the word.
Click to hear an audio file of the anti-spam word

Tags: , , , , , ,

Copyright © 2004-2008 nixCraft. All rights reserved - TOS/Disclaimer - Privacy policy - Sitemap - Powered by Open source software.