Find file
Fetching contributors…
Cannot retrieve contributors at this time
56 lines (37 sloc) 2.78 KB
unzip: |-
To use unzip to extract all members of the archive into the current directory and subdirectories below it, creating any subdirectories as necessary:
unzip letters
To extract all members of into the current directory only:
unzip -j letters
To test, printing only a summary message indicating whether the archive is OK or not:
unzip -tq letters
To test all zipfiles in the current directory, printing only the summaries:
unzip -tq \*.zip
(The backslash before the asterisk is only required if the shell expands wildcards, as in Unix; double quotes could have been used instead, as in the source examples below.) To extract to standard output all members of whose names end in .tex, auto-converting to the local end-of-line convention and piping the output into more(1):
unzip -ca letters \*.tex | more
To extract the binary file paper1.dvi to standard output and pipe it to a printing program:
unzip -p articles paper1.dvi | dvips
To extract all FORTRAN and C source files--*.f, *.c, *.h, and Makefile--into the /tmp directory:
unzip "*.[fch]" Makefile -d /tmp
(the double quotes are necessary only in Unix and only if globbing is turned on). To extract all FORTRAN and C source files, regardless of case (e.g., both *.c and *.C, and any makefile, Makefile, MAKEFILE or similar):
unzip -C "*.[fch]" makefile -d /tmp
To extract any such files but convert any uppercase MS-DOS or VMS names to lowercase and convert the line-endings of all of the files to the local standard (without respect to any files that might be marked ``binary''):
unzip -aaCL "*.[fch]" makefile -d /tmp
To extract only newer versions of the files already in the current directory, without querying (NOTE: be careful of unzipping in one timezone a zipfile created in another--ZIP archives other than those created by Zip 2.1 or later contain no timezone information, and a ``newer'' file from an eastern timezone may, in fact, be older):
unzip -fo sources
To extract newer versions of the files already in the current directory and to create any files not already there (same caveat as previous example):
unzip -uo sources
To display a diagnostic screen showing which unzip and zipinfo options are stored in environment variables, whether decryption support was compiled in, the compiler with which unzip was compiled, etc.:
unzip -v
In the last five examples, assume that UNZIP or UNZIP OPTS is set to -q. To do a singly quiet listing:
unzip -l
To do a doubly quiet listing:
unzip -ql
(Note that the ``.zip'' is generally not necessary.) To do a standard listing:
unzip --ql
unzip -l-q
unzip -l--q