≡ Menu

Zipping and Unzipping Files under Linux

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 data.zip 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 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

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:

Share this on:
{ 26 comments… add one }
  • anol September 5, 2006, 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?

  • nixcraft September 5, 2006, 8:48 pm

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

  • michel March 25, 2008, 6:39 pm

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


  • Angel February 27, 2009, 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
    its crazycat_69@hotmail.com

    Thx angel

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

    • James July 6, 2014, 3:28 pm

      sudo apt-get install zip

  • Amir zaman December 9, 2009, 10:31 am

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

  • Greg K September 1, 2010, 12:29 am

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

    • Lars June 29, 2013, 10:26 am

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

  • Satz April 28, 2011, 5:27 am

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

  • Ganapathy S June 3, 2011, 12:32 pm

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

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

      tar -xvf /dir/etc.tar

  • sibaram June 6, 2011, 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…

  • Shawn July 21, 2011, 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!’

  • Shawn July 21, 2011, 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.

  • Srinidhi January 23, 2012, 6:53 am

    can any 1 help me

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

  • steve January 24, 2012, 4:37 pm

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

  • Roland June 9, 2012, 4:49 pm

    Thank you for this useful thread.

  • Jordan July 17, 2013, 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.

  • Jared July 22, 2013, 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.

    • Derpina October 14, 2015, 11:45 pm

      What you need to save for is brains.

  • abid November 20, 2013, 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,

  • Stephen Mohos May 19, 2014, 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 7-zip.org, 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)

  • Stephen Mohos May 19, 2014, 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.

  • arrlancore March 30, 2015, 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?

  • Salem November 22, 2015, 11:56 am

    it’s like many people facing issue archiving their files on linux .
    in shor zip and unzip command not provided with linux distrbutions by dfualt .
    so we need to use tar command instead .:-
    BTW tar defualt stting not zipping file but put it on one uncompressed file with .tar extention .
    to compress with tar
    tar -czf ~/backup-archive.tar.gz ~/backup/
    ~/backup/ is the targit directory
    to uncompress on current directory
    tar – ~/backup-archive.tar.gz
    To uncmpress to specified directory
    tar -xzvf ~/backup-archive.tar.gz -C /target/directory

    This is best way compress uncompress on linux command line .

  • Ari February 2, 2016, 8:43 am

    Still, can’t use it..

Security: Are you a robot or human?

Leave a Comment

   Tagged with: , , , , , ,