Zipping and Unzipping Files under Linux

by on December 14, 2005 · 23 comments· LAST UPDATED September 23, 2013

in , ,

Asked by Yamir via e-mail

Question: MS-Windows has winzip program. I cannot find anything under Application menu to zip or unzip files on Linux. I am using Debian Linux. How do I zip and unzip file under Linux operating systems?

Answer: Linux has both zip and unzip program. By default, these utilities are not installed. You can install zip/unzip tools from the shell prompt. Open the Terminal by clicking on Application > System Tools > Terminal. You must be a root user, Type the following two commands to install zip and unzip program on Debian or Ubuntu Linux:

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

$ sudo apt-get install zip unzip
If you are Red Hat Linux/Fedora/CentOS Linux user then you can use the yum command to install zip and unzip program as follows:

# yum install zip
# yum install unzip
  • zip is a compression and file packaging utility for Linux and Unix (including FreeBSD, Solaris etc).
  • unzip will list, test, or extract files from a ZIP archive files.

ziping files/directories examples

Creates the archive and puts all the files in the current directory in it in compressed form, type:

$ zip data *

Note: No need to add .zip extension or suffix as it is added automatically by zip command.
Use the ls command to verify new zip file:
$ ls
To zip up an entire directory (including all subdirectories), type the following command:

$  zip -r data *

unziping files/directories examples

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

$ unzip

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

$ unzip -tq

To extract the file called cv.doc from

$ unzip  cv.doc

To extract all files into the /tmp directory:

$ unzip  -d /tmp

To list all files from

$ unzip -l

Linux GUI packages

You can use the following graphics packages

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

(2)GNOME Desktop: File Roller ia an Archive Manager for the GNOME Desktop.

See also

For more information please consult the following resources:

TwitterFacebookGoogle+PDF versionFound an error/typo on this page? Help us!

{ 23 comments… read them below or add one }

1 anol September 5, 2006 at 5:58 pm

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 September 5, 2006 at 8:48 pm

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


3 michel March 25, 2008 at 6:39 pm

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



4 Angel February 27, 2009 at 2:25 pm

I dont understand how you add it all
if someone is kind enough to take some time and walk me threw it please add me to msn

Thx angel

P.S i am not very computer smart
and i am really disllinking ubuntu
because i cant get thing working on it


5 James July 6, 2014 at 3:28 pm

sudo apt-get install zip


6 Amir zaman December 9, 2009 at 10:31 am

I have installed linux red hat 5 and i want to zip my folder containing pictures.
Amir zaman.


7 Greg K September 1, 2010 at 12:29 am

I’d like to zip into parts, 499mb each from 1 ssh command


8 Lars June 29, 2013 at 10:26 am

split –bytes=499m /path/to/large/file


9 Satz April 28, 2011 at 5:27 am

hi i am new in linux. how to execute a zip file in linux…


10 Ganapathy S June 3, 2011 at 12:32 pm

how to extract rar file in redhat linux system please navigate me?


11 Aswin Karthickeyan March 5, 2012 at 11:53 am

tar -xvf /dir/etc.tar


12 sibaram June 6, 2011 at 3:14 pm

I am new in ubuntu and want to install winzip software,
Plz kindly tell me what is the command to install winzip…


13 Shawn July 21, 2011 at 1:19 am

Can someone tell me how to put the zip file in another directory? I tried -d but that didn’t work, I got the error: ‘zip error: Nothing to do!’


14 Shawn July 21, 2011 at 1:20 am

I need to do it in one line btw, so I can’t use cp or mv
I’m running it with a php script.


15 Srinidhi January 23, 2012 at 6:53 am

can any 1 help me

How to rename or replays a filefolder in odi O.S Linux redhat


16 steve January 24, 2012 at 4:37 pm

Shawn cp /directory /home/name/place you want
Ganapathy tar -zxvf filename.tar.gz


17 Roland June 9, 2012 at 4:49 pm

Thank you for this useful thread.


18 Jordan July 17, 2013 at 4:55 am

This doesn’t seem to produce a file, it goes through deflating all the files, but no file is made… I can even grep the entire system and there will be no .zip fie of any sort.


19 Jared July 22, 2013 at 1:45 am

Garbage! Yeah, it creates *AN* archive, and *SOME* things might be able to read it, but its clearly not a valid, standard one, and some software won’t recognize the file or read it all. Thus, its basically outputing garbage. I need to save for a real operating system, one that actually runs useful softward.


20 abid November 20, 2013 at 7:17 am

after installing zip { # apt-get install zip }
to unzip a file in linux (ubuntu) just type :
unzip foldername
no need to add extension (zip)
and thats it,


21 Stephen Mohos May 19, 2014 at 6:15 pm

This is an answer to almost every single problem with unzipping files under Linux. Ironically enough this involves using the program 7-zip for Windows. (Bear with me here, this is actually helpful for those who have issues with Linux unzipping programs)

1. Install WINE (sudo apt-get install wine)

2. Download and install the 7-zip exe version (download from, double click it to install, WINE should run the installation program, just go through the prompts to finish install)

3. Add the 7-zip icon to the panel beside the task bar (It is located in Start menu > WINE > Programs > 7-Zip), there is a way to do this for most desktops.

4. Click and drag the archive you want to extract onto the icon beside the task bar. It will open the program 7-zip and from there all you have to do is click on Extract and pick a directory (the file’s current directory is default)


22 Stephen Mohos May 19, 2014 at 6:17 pm

NOTE: I posted this idea as an alternative for when all else fails, I am not in any way endorsing use of this program for any other reason.


23 arrlancore March 30, 2015 at 12:44 am

This methode can be using for back up my data on server linux. But i am confused with how to download my data zip to my computer from the server?


Leave a Comment

Tagged as: , , , , , ,

Previous post:

Next post: