xref: /freebsd/contrib/libarchive/unzip/bsdunzip.1 (revision e64fe029e9d3ce476e77a478318e0c3cd201ff08)
1*e64fe029SMartin Matuska.\"-
2*e64fe029SMartin Matuska.\" Copyright (c) 2007-2008 Dag-Erling Smørgrav
3*e64fe029SMartin Matuska.\" All rights reserved.
4*e64fe029SMartin Matuska.\"
5*e64fe029SMartin Matuska.\" Redistribution and use in source and binary forms, with or without
6*e64fe029SMartin Matuska.\" modification, are permitted provided that the following conditions
7*e64fe029SMartin Matuska.\" are met:
8*e64fe029SMartin Matuska.\" 1. Redistributions of source code must retain the above copyright
9*e64fe029SMartin Matuska.\"    notice, this list of conditions and the following disclaimer.
10*e64fe029SMartin Matuska.\" 2. Redistributions in binary form must reproduce the above copyright
11*e64fe029SMartin Matuska.\"    notice, this list of conditions and the following disclaimer in the
12*e64fe029SMartin Matuska.\"    documentation and/or other materials provided with the distribution.
13*e64fe029SMartin Matuska.\"
14*e64fe029SMartin Matuska.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
15*e64fe029SMartin Matuska.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
16*e64fe029SMartin Matuska.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
17*e64fe029SMartin Matuska.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
18*e64fe029SMartin Matuska.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
19*e64fe029SMartin Matuska.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
20*e64fe029SMartin Matuska.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21*e64fe029SMartin Matuska.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22*e64fe029SMartin Matuska.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23*e64fe029SMartin Matuska.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
24*e64fe029SMartin Matuska.\" SUCH DAMAGE.
25*e64fe029SMartin Matuska.\"
26*e64fe029SMartin Matuska.\" $FreeBSD$
27*e64fe029SMartin Matuska.\"
28*e64fe029SMartin Matuska.Dd January 2, 2023
29*e64fe029SMartin Matuska.Dt BSDUNZIP 1
30*e64fe029SMartin Matuska.Os
31*e64fe029SMartin Matuska.Sh NAME
32*e64fe029SMartin Matuska.Nm bsdunzip
33*e64fe029SMartin Matuska.Nd extract files from a ZIP archive
34*e64fe029SMartin Matuska.Sh SYNOPSIS
35*e64fe029SMartin Matuska.Nm
36*e64fe029SMartin Matuska.Op Fl aCcfjLlnopqtuvy
37*e64fe029SMartin Matuska.Op Fl d Ar dir
38*e64fe029SMartin Matuska.Op Fl x Ar pattern
39*e64fe029SMartin Matuska.Op Fl P Ar password
40*e64fe029SMartin Matuska.Ar zipfile
41*e64fe029SMartin Matuska.Op Ar member ...
42*e64fe029SMartin Matuska.Sh DESCRIPTION
43*e64fe029SMartin Matuska.\" ...
44*e64fe029SMartin MatuskaThe following options are available:
45*e64fe029SMartin Matuska.Bl -tag -width Fl
46*e64fe029SMartin Matuska.It Fl a
47*e64fe029SMartin MatuskaWhen extracting a text file, convert DOS-style line endings to
48*e64fe029SMartin MatuskaUnix-style line endings.
49*e64fe029SMartin Matuska.It Fl C
50*e64fe029SMartin MatuskaMatch file names case-insensitively.
51*e64fe029SMartin Matuska.It Fl c
52*e64fe029SMartin MatuskaExtract to stdout/screen.
53*e64fe029SMartin MatuskaWhen extracting files from the zipfile, they are written to stdout.
54*e64fe029SMartin MatuskaThis is similar to
55*e64fe029SMartin Matuska.Fl p ,
56*e64fe029SMartin Matuskabut does not suppress normal output.
57*e64fe029SMartin Matuska.It Fl d Ar dir
58*e64fe029SMartin MatuskaExtract files into the specified directory rather than the current
59*e64fe029SMartin Matuskadirectory.
60*e64fe029SMartin Matuska.It Fl f
61*e64fe029SMartin MatuskaUpdate existing.
62*e64fe029SMartin MatuskaExtract only files from the zipfile if a file with the same name
63*e64fe029SMartin Matuskaalready exists on disk and is older than the former.
64*e64fe029SMartin MatuskaOtherwise, the file is silently skipped.
65*e64fe029SMartin Matuska.It Fl j
66*e64fe029SMartin MatuskaIgnore directories stored in the zipfile; instead, extract all files
67*e64fe029SMartin Matuskadirectly into the extraction directory.
68*e64fe029SMartin Matuska.It Fl L
69*e64fe029SMartin MatuskaConvert the names of the extracted files and directories to lowercase.
70*e64fe029SMartin Matuska.It Fl l
71*e64fe029SMartin MatuskaList, rather than extract, the contents of the zipfile.
72*e64fe029SMartin Matuska.It Fl n
73*e64fe029SMartin MatuskaNo overwrite.
74*e64fe029SMartin MatuskaWhen extracting a file from the zipfile, if a file with the same name
75*e64fe029SMartin Matuskaalready exists on disk, the file is silently skipped.
76*e64fe029SMartin Matuska.It Fl o
77*e64fe029SMartin MatuskaOverwrite.
78*e64fe029SMartin MatuskaWhen extracting a file from the zipfile, if a file with the same name
79*e64fe029SMartin Matuskaalready exists on disk, the existing file is replaced with the file
80*e64fe029SMartin Matuskafrom the zipfile.
81*e64fe029SMartin Matuska.It Fl p
82*e64fe029SMartin MatuskaExtract to stdout.
83*e64fe029SMartin MatuskaWhen extracting files from the zipfile, they are written to stdout.
84*e64fe029SMartin MatuskaThe normal output is suppressed as if
85*e64fe029SMartin Matuska.Fl q
86*e64fe029SMartin Matuskawas specified.
87*e64fe029SMartin Matuska.It Fl P Ar password
88*e64fe029SMartin MatuskaExtract encrypted files using a password.
89*e64fe029SMartin MatuskaPutting a password on the command line using this option can be
90*e64fe029SMartin Matuskainsecure.
91*e64fe029SMartin Matuska.It Fl q
92*e64fe029SMartin MatuskaQuiet: print less information while extracting.
93*e64fe029SMartin Matuska.It Fl t
94*e64fe029SMartin MatuskaTest: do not extract anything, but verify the checksum of every file
95*e64fe029SMartin Matuskain the archive.
96*e64fe029SMartin Matuska.It Fl u
97*e64fe029SMartin MatuskaUpdate.
98*e64fe029SMartin MatuskaWhen extracting a file from the zipfile, if a file with the same name
99*e64fe029SMartin Matuskaalready exists on disk, the existing file is replaced with the file
100*e64fe029SMartin Matuskafrom the zipfile if and only if the latter is newer than the former.
101*e64fe029SMartin MatuskaOtherwise, the file is silently skipped.
102*e64fe029SMartin Matuska.It Fl v
103*e64fe029SMartin MatuskaList verbosely, rather than extract, the contents of the zipfile.
104*e64fe029SMartin MatuskaThis differs from
105*e64fe029SMartin Matuska.Fl l
106*e64fe029SMartin Matuskaby using the long listing.
107*e64fe029SMartin MatuskaNote that most of the data is currently fake and does not reflect the
108*e64fe029SMartin Matuskacontent of the archive.
109*e64fe029SMartin Matuska.It Fl x Ar pattern
110*e64fe029SMartin MatuskaExclude files matching the pattern
111*e64fe029SMartin Matuska.Ar pattern .
112*e64fe029SMartin Matuska.It Fl y
113*e64fe029SMartin MatuskaPrint four digit years in listings instead of two.
114*e64fe029SMartin Matuska.It Fl Z Ar mode
115*e64fe029SMartin MatuskaEmulate
116*e64fe029SMartin Matuska.Xr zipinfo 1L
117*e64fe029SMartin Matuskamode.
118*e64fe029SMartin MatuskaEnabling
119*e64fe029SMartin Matuska.Xr zipinfo 1L
120*e64fe029SMartin Matuskamode changes the way in which additional arguments are parsed.
121*e64fe029SMartin MatuskaCurrently only
122*e64fe029SMartin Matuska.Xr zipinfo 1L
123*e64fe029SMartin Matuskamode 1 is supported, which lists the file names one per line.
124*e64fe029SMartin Matuska.It Ar [member ...]
125*e64fe029SMartin MatuskaOptional list of members to extract from the zipfile.
126*e64fe029SMartin MatuskaCan include patterns, e.g.
127*e64fe029SMartin Matuska.Ar 'memberdir/*'
128*e64fe029SMartin Matuskawill extract all files and dirs below memberdir.
129*e64fe029SMartin Matuska.El
130*e64fe029SMartin Matuska.Pp
131*e64fe029SMartin MatuskaNote that only one of
132*e64fe029SMartin Matuska.Fl n ,
133*e64fe029SMartin Matuska.Fl o ,
134*e64fe029SMartin Matuskaand
135*e64fe029SMartin Matuska.Fl u
136*e64fe029SMartin Matuskamay be specified.
137*e64fe029SMartin MatuskaIf specified filename is
138*e64fe029SMartin Matuska.Qq - ,
139*e64fe029SMartin Matuskathen data is read from
140*e64fe029SMartin Matuska.Va stdin .
141*e64fe029SMartin Matuska.Sh ENVIRONMENT
142*e64fe029SMartin MatuskaIf the
143*e64fe029SMartin Matuska.Ev UNZIP_DEBUG
144*e64fe029SMartin Matuskaenvironment variable is defined, the
145*e64fe029SMartin Matuska.Fl q
146*e64fe029SMartin Matuskacommand-line option has no effect, and additional debugging
147*e64fe029SMartin Matuskainformation will be printed to
148*e64fe029SMartin Matuska.Va stderr .
149*e64fe029SMartin Matuska.Sh COMPATIBILITY
150*e64fe029SMartin MatuskaThe
151*e64fe029SMartin Matuska.Nm
152*e64fe029SMartin Matuskautility aims to be sufficiently compatible with other implementations
153*e64fe029SMartin Matuskato serve as a drop-in replacement in the context of the
154*e64fe029SMartin Matuska.Xr ports 7
155*e64fe029SMartin Matuskasystem.
156*e64fe029SMartin MatuskaNo attempt has been made to replicate functionality which is not
157*e64fe029SMartin Matuskarequired for that purpose.
158*e64fe029SMartin Matuska.Pp
159*e64fe029SMartin MatuskaFor compatibility reasons, command-line options will be recognized if
160*e64fe029SMartin Matuskathey are listed not only before but also after the name of the
161*e64fe029SMartin Matuskazipfile.
162*e64fe029SMartin Matuska.Pp
163*e64fe029SMartin MatuskaNormally, the
164*e64fe029SMartin Matuska.Fl a
165*e64fe029SMartin Matuskaoption should only affect files which are marked as text files in the
166*e64fe029SMartin Matuskazipfile's central directory.
167*e64fe029SMartin MatuskaSince the
168*e64fe029SMartin Matuska.Xr archive 3
169*e64fe029SMartin Matuskalibrary does not provide access to that information, it is not available
170*e64fe029SMartin Matuskato the
171*e64fe029SMartin Matuska.Nm
172*e64fe029SMartin Matuskautility.
173*e64fe029SMartin MatuskaInstead, the
174*e64fe029SMartin Matuska.Nm
175*e64fe029SMartin Matuskautility will assume that a file is a text file if no non-ASCII
176*e64fe029SMartin Matuskacharacters are present within the first block of data decompressed for
177*e64fe029SMartin Matuskathat file.
178*e64fe029SMartin MatuskaIf non-ASCII characters appear in subsequent blocks of data, a warning
179*e64fe029SMartin Matuskawill be issued.
180*e64fe029SMartin Matuska.Pp
181*e64fe029SMartin MatuskaThe
182*e64fe029SMartin Matuska.Nm
183*e64fe029SMartin Matuskautility is only able to process ZIP archives handled by
184*e64fe029SMartin Matuska.Xr libarchive 3 .
185*e64fe029SMartin MatuskaDepending on the installed version of
186*e64fe029SMartin Matuska.Xr libarchive 3 ,
187*e64fe029SMartin Matuskathis may or may not include self-extracting or ZIPX archives.
188*e64fe029SMartin Matuska.Sh SEE ALSO
189*e64fe029SMartin Matuska.Xr libarchive 3
190*e64fe029SMartin Matuska.Sh HISTORY
191*e64fe029SMartin MatuskaThe
192*e64fe029SMartin Matuska.Nm
193*e64fe029SMartin Matuskautility appeared in
194*e64fe029SMartin Matuska.Fx 8.0 .
195*e64fe029SMartin Matuska.Sh AUTHORS
196*e64fe029SMartin MatuskaThe
197*e64fe029SMartin Matuska.Nm
198*e64fe029SMartin Matuskautility and this manual page were written by
199*e64fe029SMartin Matuska.An Dag-Erling Sm\(/orgrav Aq Mt des@FreeBSD.org .
200*e64fe029SMartin MatuskaIt uses the
201*e64fe029SMartin Matuska.Xr archive 3
202*e64fe029SMartin Matuskalibrary developed by
203*e64fe029SMartin Matuska.An Tim Kientzle Aq Mt kientzle@FreeBSD.org .
204*e64fe029SMartin Matuska.Sh CAVEATS
205*e64fe029SMartin MatuskaThe
206*e64fe029SMartin Matuska.Nm
207*e64fe029SMartin Matuskautility performs two scans of the command-line for arguments before
208*e64fe029SMartin Matuskaand after the archive name, so as to maintain compatibility with
209*e64fe029SMartin MatuskaInfo-ZIP unzip.
210*e64fe029SMartin MatuskaAs a result, the POSIX
211*e64fe029SMartin Matuska.Ql --
212*e64fe029SMartin Matuskadouble-dash string used to separate options from arguments will need to
213*e64fe029SMartin Matuskabe repeated.
214*e64fe029SMartin MatuskaFor example, to extract a "-a.jpg" from "-b.zip" with overwrite, one
215*e64fe029SMartin Matuskawould need to invoke
216*e64fe029SMartin Matuska.Dl bsdunzip -o -- -a.jpg -- -b.zip
217