xref: /dragonfly/usr.bin/unzip/unzip.1 (revision b5302a4e)
1.\"-
2.\" Copyright (c) 2007-2008 Dag-Erling Smørgrav
3.\" All rights reserved.
4.\"
5.\" Redistribution and use in source and binary forms, with or without
6.\" modification, are permitted provided that the following conditions
7.\" are met:
8.\" 1. Redistributions of source code must retain the above copyright
9.\"    notice, this list of conditions and the following disclaimer.
10.\" 2. Redistributions in binary form must reproduce the above copyright
11.\"    notice, this list of conditions and the following disclaimer in the
12.\"    documentation and/or other materials provided with the distribution.
13.\"
14.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
15.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
16.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
17.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
18.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
19.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
20.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
24.\" SUCH DAMAGE.
25.\"
26.\" $FreeBSD: head/usr.bin/unzip/unzip.1 294107 2016-01-15 22:58:23Z ak $
27.\"
28.Dd December 12, 2015
29.Dt UNZIP 1
30.Os
31.Sh NAME
32.Nm unzip
33.Nd extract files from a ZIP archive
34.Sh SYNOPSIS
35.Nm
36.Op Fl aCcfjLlnopqtuvy
37.Op Fl d Ar dir
38.Ar zipfile
39.Sh DESCRIPTION
40.\" ...
41The following options are available:
42.Bl -tag -width Fl
43.It Fl a
44When extracting a text file, convert DOS-style line endings to
45Unix-style line endings.
46.It Fl C
47Match file names case-insensitively.
48.It Fl c
49Extract to stdout/screen.
50When extracting files from the zipfile, they are written to stdout.
51This is similar to
52.Fl p ,
53but does not suppress normal output.
54.It Fl d Ar dir
55Extract files into the specified directory rather than the current
56directory.
57.It Fl f
58Update existing.
59Extract only files from the zipfile if a file with the same name
60already exists on disk and is older than the former.
61Otherwise, the file is silently skipped.
62.It Fl j
63Ignore directories stored in the zipfile; instead, extract all files
64directly into the extraction directory.
65.It Fl L
66Convert the names of the extracted files and directories to lowercase.
67.It Fl l
68List, rather than extract, the contents of the zipfile.
69.It Fl n
70No overwrite.
71When extracting a file from the zipfile, if a file with the same name
72already exists on disk, the file is silently skipped.
73.It Fl o
74Overwrite.
75When extracting a file from the zipfile, if a file with the same name
76already exists on disk, the existing file is replaced with the file
77from the zipfile.
78.It Fl p
79Extract to stdout.
80When extracting files from the zipfile, they are written to stdout.
81The normal output is suppressed as if
82.Fl q
83was specified.
84.It Fl q
85Quiet: print less information while extracting.
86.It Fl t
87Test: do not extract anything, but verify the checksum of every file
88in the archive.
89.It Fl u
90Update.
91When extracting a file from the zipfile, if a file with the same name
92already exists on disk, the existing file is replaced with the file
93from the zipfile if and only if the latter is newer than the former.
94Otherwise, the file is silently skipped.
95.It Fl v
96List verbosely, rather than extract, the contents of the zipfile.
97This differs from
98.Fl l
99by using the long listing.
100Note that most of the data is currently fake and does not reflect the
101content of the archive.
102.It Fl x Ar pattern
103Exclude files matching the pattern
104.Ar pattern .
105.It Fl y
106Print four digit years in listings instead of two.
107.It Fl Z Ar mode
108Emulate
109.Xr zipinfo 1L
110mode.
111Enabling
112.Xr zipinfo 1L
113mode changes the way in which additional arguments are parsed.
114Currently only
115.Xr zipinfo 1L
116mode 1 is supported, which lists the file names one per line.
117.El
118.Pp
119Note that only one of
120.Fl n ,
121.Fl o ,
122and
123.Fl u
124may be specified.
125If specified filename is
126.Qq - ,
127then data is read from
128.Va stdin .
129.Sh ENVIRONMENT
130If the
131.Ev UNZIP_DEBUG
132environment variable is defined, the
133.Fl q
134command-line option has no effect, and additional debugging
135information will be printed to
136.Va stderr .
137.Sh COMPATIBILITY
138The
139.Nm
140utility aims to be sufficiently compatible with other implementations
141to serve as a drop-in replacement in the context of the
142.Xr ports 7
143system.
144No attempt has been made to replicate functionality which is not
145required for that purpose.
146.Pp
147For compatibility reasons, command-line options will be recognized if
148they are listed not only before but also after the name of the
149zipfile.
150.Pp
151Normally, the
152.Fl a
153option should only affect files which are marked as text files in the
154zipfile's central directory.
155Since the
156.Xr archive 3
157library does not provide access to that information, it is not available
158to the
159.Nm
160utility.
161Instead, the
162.Nm
163utility will assume that a file is a text file if no non-ASCII
164characters are present within the first block of data decompressed for
165that file.
166If non-ASCII characters appear in subsequent blocks of data, a warning
167will be issued.
168.Pp
169The
170.Nm
171utility is only able to process ZIP archives handled by
172.Xr libarchive 3 .
173Depending on the installed version of
174.Xr libarchive ,
175this may or may not include self-extracting archives.
176.Sh SEE ALSO
177.Xr libarchive 3
178.Sh HISTORY
179The
180.Nm
181utility appeared in
182.Fx 8.0
183and
184.Dx 4.5 .
185.Sh AUTHORS
186The
187.Nm
188utility and this manual page were written by
189.An Dag-Erling Sm\(/orgrav Aq Mt des@FreeBSD.org .
190It uses the
191.Xr archive 3
192library developed by
193.An Tim Kientzle Aq Mt kientzle@FreeBSD.org .
194