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