xref: /netbsd-src/usr.bin/unzip/unzip.1 (revision 10ad5ffa714ce1a679dcc9dd8159648df2d67b5a)
1.\"-
2.\" Copyright (c) 2007-2008 Dag-Erling Co�dan 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: revision 180125$
27.\" $NetBSD: unzip.1,v 1.2 2009/06/26 09:31:04 wiz Exp $
28.\"
29.Dd June 30, 2008
30.Dt UNZIP 1
31.Os
32.Sh NAME
33.Nm unzip
34.Nd extract files from a ZIP archive
35.Sh SYNOPSIS
36.Nm
37.Op Fl afjLlnoqtu
38.Op Fl d Ar dir
39.Op Fl x Ar pattern
40.Ar zipfile
41.Sh DESCRIPTION
42The following options are available:
43.Bl -tag -width Fl
44.It Fl a
45When extracting a text file, convert DOS-style line endings to
46Unix-style line endings.
47.It Fl d Ar dir
48Extract files into the specified directory rather than the current
49directory.
50.It Fl f
51Update existing.
52Extract only files from the zipfile if a file with the same name
53already exists on disk and is older than the former.
54Otherwise, the file is silently skipped.
55.It Fl j
56Ignore directories stored in the zipfile; instead, extract all files
57directly into the extraction directory.
58.It Fl L
59Convert the names of the extracted files and directories to lowercase.
60.It Fl l
61List, rather than extract, the contents of the zipfile.
62.It Fl n
63No overwrite.
64When extracting a file from the zipfile, if a file with the same name
65already exists on disk, the file is silently skipped.
66.It Fl o
67Overwrite.
68When extacting a file from the zipfile, if a file with the same name
69already exists on disk, the existing file is replaced with the file
70from the zipfile.
71.It Fl q
72Quiet: print less information while extracting.
73.It Fl t
74Test: do not extract anything, but verify the checksum of every file
75in the archive.
76.It Fl u
77Update.
78When extracting a file from the zipfile, if a file with the same name
79already exists on disk, the existing file is replaced with the file
80from the zipfile if and only if the latter is newer than the former.
81Otherwise, the file is silently skipped.
82.It Fl x Ar pattern
83Exclude files matching the pattern
84.Ar pattern .
85.El
86.Pp
87Note that only one of
88.Fl n ,
89.Fl o ,
90and
91.Fl u
92may be specified.
93.Sh ENVIRONMENT
94If the
95.Ev UNZIP_DEBUG
96environment variable is defined, the
97.Fl q
98command-line option has no effect, and additional debugging
99information will be printed to
100.Va stderr .
101.Sh COMPATIBILITY
102The
103.Nm
104utility aims to be sufficiently compatible with other implementations
105to serve as a drop-in replacement in the context of the
106.Xr pkgsrc 7
107system.
108No attempt has been made to replicate functionality which is not
109required for that purpose.
110.Pp
111For compatibility reasons, command-line options will be recognized if
112they are listed not only before but also after the name of the
113zipfile.
114.Pp
115Normally, the
116.Fl a
117option should only affect files which are marked as text files in the
118zipfile's central directory.
119Since the
120.Xr archive 3
121library reads zipfiles sequentially, and does not use the central
122directory, that information is not available to the
123.Nm
124utility.
125Instead, the
126.Nm
127utility will assume that a file is a text file if no non-ASCII
128characters are present within the first block of data decompressed for
129that file.
130If non-ASCII characters appear in subsequent blocks of data, a warning
131will be issued.
132.Pp
133The
134.Nm
135utility is only able to process ZIP archives handled by
136.Xr libarchive 3 .
137Depending on the installed version of
138.Xr libarchive 3 ,
139this may or may not include self-extracting archives.
140.Sh SEE ALSO
141.Xr libarchive 3
142.Sh HISTORY
143The
144.Nm
145utility appeared in
146.Nx 6.0 .
147.Sh AUTHORS
148The
149.Nm
150utility and this manual page were written by
151.An Dag-Erling Sm\(/orgrav Aq des@FreeBSD.org .
152It uses the
153.Xr archive 3
154library developed by
155.An Tim Kientzle Aq kientzle@FreeBSD.org .
156.Sh BUGS
157The
158.Nm
159utility currently does not support asking the user whether to
160overwrite or skip a file that already exists on disk.
161To be on the safe side, it will fail if it encounters a file that
162already exists and neither the
163.Fl n
164nor the
165.Fl o
166command line option was specified.
167