1BSDUNZIP(1) BSD General Commands Manual BSDUNZIP(1)
2
4 bsdunzip — extract files from a ZIP archive
5
7 bsdunzip [-aCcfjLlnopqtuvy] [{ -O | -I } encoding] [-d dir] [-x pattern]
8 [-P password] zipfile [member ...]
9
11 The following options are available:
12
13 -a When extracting a text file, convert DOS-style line endings
14 to Unix-style line endings.
15
16 -C Match file names case-insensitively.
17
18 -c Extract to stdout/screen. When extracting files from the
19 zipfile, they are written to stdout. This is similar to -p,
20 but does not suppress normal output.
21
22 -d dir Extract files into the specified directory rather than the
23 current directory.
24
25 -f Update existing. Extract only files from the zipfile if a
26 file with the same name already exists on disk and is older
27 than the former. Otherwise, the file is silently skipped.
28
29 -I encoding
30
31 -O encoding
32 Convert filenames from the specified encoding.
33
34 -j Ignore directories stored in the zipfile; instead, extract
35 all files directly into the extraction directory.
36
37 -L Convert the names of the extracted files and directories to
38 lowercase.
39
40 -l List, rather than extract, the contents of the zipfile.
41
42 -n No overwrite. When extracting a file from the zipfile, if a
43 file with the same name already exists on disk, the file is
44 silently skipped.
45
46 -o Overwrite. When extracting a file from the zipfile, if a
47 file with the same name already exists on disk, the existing
48 file is replaced with the file from the zipfile.
49
50 -p Extract to stdout. When extracting files from the zipfile,
51 they are written to stdout. The normal output is suppressed
52 as if -q was specified.
53
54 -P password
55 Extract encrypted files using a password. Putting a password
56 on the command line using this option can be insecure.
57
58 -q Quiet: print less information while extracting.
59
60 -t Test: do not extract anything, but verify the checksum of ev‐
61 ery file in the archive.
62
63 -u Update. When extracting a file from the zipfile, if a file
64 with the same name already exists on disk, the existing file
65 is replaced with the file from the zipfile if and only if the
66 latter is newer than the former. Otherwise, the file is
67 silently skipped.
68
69 -v List verbosely, rather than extract, the contents of the zip‐
70 file. This differs from -l by using the long listing. Note
71 that most of the data is currently fake and does not reflect
72 the content of the archive.
73
74 -x pattern Exclude files matching the pattern pattern.
75
76 -y Print four digit years in listings instead of two.
77
78 -Z mode Emulate zipinfo(1L) mode. Enabling zipinfo(1L) mode changes
79 the way in which additional arguments are parsed. Currently
80 only zipinfo(1L) mode 1 is supported, which lists the file
81 names one per line.
82
83 [member ...]
84 Optional list of members to extract from the zipfile. Can
85 include patterns, e.g., 'memberdir/*' will extract all files
86 and dirs below memberdir.
87
88 Note that only one of -n, -o, and -u may be specified. If specified
89 filename is "-", then data is read from stdin.
90
92 If the UNZIP_DEBUG environment variable is defined, the -q command-line
93 option has no effect, and additional debugging information will be
94 printed to stderr.
95
97 The bsdunzip utility aims to be sufficiently compatible with other imple‐
98 mentations to serve as a drop-in replacement in the context of the
99 ports(7) system. No attempt has been made to replicate functionality
100 which is not required for that purpose.
101
102 For compatibility reasons, command-line options will be recognized if
103 they are listed not only before but also after the name of the zipfile.
104
105 Normally, the -a option should only affect files which are marked as text
106 files in the zipfile's central directory. Since the archive(3) library
107 does not provide access to that information, it is not available to the
108 bsdunzip utility. Instead, the bsdunzip utility will assume that a file
109 is a text file if no non-ASCII characters are present within the first
110 block of data decompressed for that file. If non-ASCII characters appear
111 in subsequent blocks of data, a warning will be issued.
112
113 The bsdunzip utility is only able to process ZIP archives handled by
114 libarchive(3). Depending on the installed version of libarchive(3), this
115 may or may not include self-extracting or ZIPX archives.
116
118 libarchive(3)
119
121 The bsdunzip utility appeared in FreeBSD 8.0.
122
124 The bsdunzip utility and this manual page were written by Dag-Erling
125 Smørgrav <des@FreeBSD.org>. It uses the archive(3) library developed by
126 Tim Kientzle <kientzle@FreeBSD.org>.
127
129 The bsdunzip utility performs two scans of the command-line for arguments
130 before and after the archive name, so as to maintain compatibility with
131 Info-ZIP unzip. As a result, the POSIX ‘--’ double-dash string used to
132 separate options from arguments will need to be repeated. For example,
133 to extract a "-a.jpg" from "-b.zip" with overwrite, one would need to in‐
134 voke
135 bsdunzip -o -- -a.jpg -- -b.zip
136
137BSD June 27, 2023 BSD