Zipping and Unzipping Files under Linux

last updated in Categories File system, Linux desktop, Linux distribution

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:


Posted by: Vivek Gite

The author is the creator of nixCraft and a seasoned sysadmin, DevOps engineer, and a trainer for the Linux operating system/Unix shell scripting. Get the latest tutorials on SysAdmin, Linux/Unix and open source topics via RSS/XML feed or weekly email newsletter.

26 comment

  1. 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. 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

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

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

  5. Hi,
    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!’

  6. 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.

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

  8. 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.

  9. 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,

  10. 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)

  11. 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.

  12. 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?

  13. 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 .

    Have a question? Post it on our forum!