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