Rob Davarnia

Linux

How to Zip and Unzip in Linux?

Posted on .

How to Zip and Unzip in Linux?

Introduction

Sometimes moving and copying files is a hassle. Windows and Mac can zip and unzip files without installing any applications, but under Linux you need to install zip/unzip packages.

For Debian/Ubuntu:
sudo apt-get install zip unzip

For CentOS/Fedora/Red Hat:
yum install zip unzip

Zipping

Zip the current folder and its subdirectories recursively
zip -r archive *

Zip all the files in the current folder
zip archive *

Zip the current folder and its subdirectories recursively, with verbose output
zip -r -v archive *

Unzipping

Unzip the archive
unzip archive.zip

List the files in the zip file
unzip -l archive.zip

Unzip the archive in the specified path
unzip archive.zip -d /my/awesome/path

Unzip the zip archive and overwrite the files without prompting
unzip -o archive.zip

Unzip the zip archive and never overwrite the existing files
unzip -n archive.zip

profile

Rob Davarnia

http://robdvr.com

I’m a Developer from Orange County, California. I'm a huge supporter of Open Source Projects, and making Web a better place.

There are no comments.

Leave a Reply

View Comments (0) ...
Navigation