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 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 to the current directory, enter

$ zip -b /tmp data *

unzip examples

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

$ unzip

To extract all files into the /tmp directory, enter

$ unzip -d /tmp

To list all files from, enter

$ unzip -l

Related Posts:

Previous post:

Next post: