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:
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
You can use the following graphics packages
For more information please consult the following resources:
- Compressing files under Linux or UNIX cheat sheet
- Read man pages of zip and unzip (type man zip or man unzip at shell prompt)
- ark handbook
- File Roller home page