2007-09-06-extract-zip-files-in-linux.md 1.42 KB
Newer Older
Danesh Manoharan's avatar
Danesh Manoharan committed
1
2
---
title: Extract ZIP files in Linux
3
author: Danesh Manoharan
Danesh Manoharan's avatar
Danesh Manoharan committed
4
5
6
7
8
9
10
11
12
date: 2007-09-05T17:12:59+00:00
pvc_views:
  - 35901
dsq_thread_id:
  - 889737421

---
ZIP archives are most commonly used in Windows/MS-DOS based environments.

13
In Linux, you can use the "unzip" command to extract,list or test ZIP files. Below are the common tasks I use "unzip" for.
Danesh Manoharan's avatar
Danesh Manoharan committed
14

15
Extract the contents of a ZIP file into it's own directory and also create subdirectories as needed.
Danesh Manoharan's avatar
Danesh Manoharan committed
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30

> \# unzip [filename].zip

Extract the contents of a ZIP file into the current directory only. No subdirectories will be created.

> \# unzip -j [filename].zip

Extract the contents of a ZIp file into a custom directory.

> \# unzip -d \[target directory\] \[filename\].zip

List the contents of a ZIP file.

> \# unzip -l [filename].zip

31
Test the integrity of a ZIP file and it's contents.
Danesh Manoharan's avatar
Danesh Manoharan committed
32
33
34
35
36
37
38
39
40
41
42

>  # unzip -t [filename].zip
> 
> \# unzip -tq [filename].zip (Only shows summary)

Extract the contents of a ZIP file only if the files already exist in the target directory. Good for upgrades.

> \# unzip -f [filename].zip
> 
> \# unzip -fo [filename].zip (non interactive. Yes to all)

43
Extract the contents of a ZIP file if the contents are newer then what's available in the target directory or don't exist yet. Good for upgrades.
Danesh Manoharan's avatar
Danesh Manoharan committed
44
45
46
47
48
49

> \# unzip -u [filename].zip
> 
> \# unzip -uo [filename].zip (non interactive. Yes to all)

Did this help? If you need further information please drop me a comment.