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 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:

🐧 Get the latest tutorials on Linux, Open Source & DevOps via RSS feed or Weekly email newsletter.

🐧 26 comments so far... add one
CategoryList of Unix and Linux commands
Disk space analyzersncdu pydf
File Managementcat
FirewallAlpine Awall CentOS 8 OpenSUSE RHEL 8 Ubuntu 16.04 Ubuntu 18.04 Ubuntu 20.04
Network UtilitiesNetHogs dig host ip nmap
OpenVPNCentOS 7 CentOS 8 Debian 10 Debian 8/9 Ubuntu 18.04 Ubuntu 20.04
Package Managerapk apt
Processes Managementbg chroot cron disown fg jobs killall kill pidof pstree pwdx time
Searchinggrep whereis which
User Informationgroups id lastcomm last lid/libuser-lid logname members users whoami who w
WireGuard VPNAlpine CentOS 8 Debian 10 Firewall Ubuntu 20.04
26 comments… add one
  • anol Sep 5, 2006 @ 17:58

    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 Sep 5, 2006 @ 20:48

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

  • michel Mar 25, 2008 @ 18:39

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


  • Angel Feb 27, 2009 @ 14:25

    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

    • James Jul 6, 2014 @ 15:28

      sudo apt-get install zip

  • Amir zaman Dec 9, 2009 @ 10:31

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

  • Greg K Sep 1, 2010 @ 0:29

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

    • Lars Jun 29, 2013 @ 10:26

      split Γ’β‚¬β€œbytes=499m /path/to/large/file

  • Satz Apr 28, 2011 @ 5:27

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

  • Ganapathy S Jun 3, 2011 @ 12:32

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

    • Aswin Karthickeyan Mar 5, 2012 @ 11:53

      tar -xvf /dir/etc.tar

  • sibaram Jun 6, 2011 @ 15:14

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

  • Shawn Jul 21, 2011 @ 1:19

    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 Jul 21, 2011 @ 1:20

    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 Jan 23, 2012 @ 6:53

    can any 1 help me

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

  • steve Jan 24, 2012 @ 16:37

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

  • Roland Jun 9, 2012 @ 16:49

    Thank you for this useful thread.

  • Jordan Jul 17, 2013 @ 4:55

    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 Jul 22, 2013 @ 1:45

    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 Oct 14, 2015 @ 23:45

      What you need to save for is brains.

  • abid Nov 20, 2013 @ 7:17

    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 @ 18:15

    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)

  • Stephen Mohos May 19, 2014 @ 18:17

    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 Mar 30, 2015 @ 0:44

    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 Nov 22, 2015 @ 11:56

    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 Feb 2, 2016 @ 8:43

    Still, can’t use it..

Leave a Reply

Your email address will not be published.

Use HTML <pre>...</pre> for code samples. Still have questions? Post it on our forum