Zipping And Unzipping Files Under Linux

by lifeLinux on May 27, 2011

Neither the zip nor the unzip utilities are included in the default install of Linux. To install them from shell prompt, you must be a root user and type following two commands to install zip and unzip program.

If you are using RedHat / CentOS / Fedora then enter

# yum install zip unzip

If you are using Ubuntu / Debian then enter

# apt-get install zip unzip

zip examples

Creates the archive data.zip and puts all the files in the current directory in it in compressed form, type the following command

$ zip data *

To zip up an entire directory, type the following command

$ zip -r data *

To put the zip archive in the directory /tmp and copying over data.zip to the current directory, enter

$ zip -b /tmp data *

unzip examples

To use unzip to extract all files of the archive pics.zip into the current directory, enter

$ unzip data.zip

To extract all files into the /tmp directory, enter

$ unzip data.zip -d /tmp

To list all files from data.zip, enter

$ unzip -l data.zip

Related Posts:

Previous post:

Next post: