home | O'Reilly's CD bookshelfs | FreeBSD | Linux | Cisco | Cisco Exam    

unzip

unzip [options [modifiers ]] zipfile ... [extraction options ]
unzip -Z [zipinfo options ] zipfile ...

Solaris only. (Many other modern Unix systems also have it.) unzip prints information about or extracts files from ZIP format archives. The zipfile is a ZIP archive whose filename ends in .zip . The .zip can be omitted from the command line; unzip supplies it. zipfile may also be a shell-style wildcard pattern (which should be quoted); all matching files in the ZIP archive will be acted upon. The behavior of options is affected by the various modifiers .

In the second form, the options are taken to be zipinfo options, and unzip performs like that command. See zipinfo for more information.

Options may also be included in the UNZIP environment variable, to set a default behavior. Options on the command line can override settings in $UNZIP by preceding them with an extra minus. See the Examples.

When extracting files, if a file exists already, unzip prompts for an action. You may to choose to overwrite or skip the existing file, overwrite or skip all files, or rename the current file.

Notes

  • unzip and its companion program zip (which is not included with Solaris) are part of the InfoZIP project. InfoZIP is an open collaborative compressed archive format, and implementations exist for Unix, Amiga, Atari, DEC VAX and Alpha VMS and OpenVMS, MS-DOS, Macintosh, Minix, OS/2, Windows NT, and many others. It is the only similar format one can expect to port to all of these systems without difficulty. The web home page is http://www.cdrom.com/pub/infozip .

  • Unlike most Unix tar implementations, zip removes leading slashes when it creates a ZIP archive, so there is never any problem unbundling it at another site.

  • The Java Archive format (.jar ) is based on ZIP; zip and unzip can process .jar files with no trouble.

Extraction Options

-d dir

Extract files in dir instead of in the current directory. This option need not appear at the end of the command line.

-x files

Exclude. Do not extract archive members that match files .

Options

-A

Print help for the shared library programming interface (API).

-c

Print files to standard output (the C RT). Similar to -p , but a header line is printed for each file, it allows -a , and automatically does ASCII to EBCDIC conversion. Not in the unzip usage message.

-f

Freshen existing files. Only files in the archive that are newer than existing disk files are extracted. unzip queries before overwriting, unless -o is used.

-l

List archived files, in short format (name, full size, modification time, and totals).

-p

Extract files to standard output (for piping). Only the file data is printed. No conversions are done.

-t

Test the archived files. Each file is extracted in memory, and the extracted file's CRC is compared to the stored CRC.

-T

Set the timestamp on the archive itself to be that of the newest file in the archive.

-u

Same as -f , but also extract any files that don't exist on disk yet.

-v

Be verbose or print diagnostic information. -v is both an option and a modifier, depending upon the other options. By itself, it prints the unzip ftp site information, information about how it was compiled, and what environment variable settings are in effect. With a zipfile , it adds compression information to that provided by -l .

-z

Only print the archive comment.

-Z

Run as zipinfo . Remaining options are zipinfo options. See zipinfo for more information.

Modifiers

-a [a ]

Convert text files. Normally, files are extracted as binary files. This option causes text files to be converted to the native format (e.g., adding or removing CR characters in front of LF characters). EBCDIC-to-ASCII conversion is also done as needed. Use -aa to force all files to be extracted as text.

-b

Treat all files as binary.

-B

Save a backup copy of each overwritten file in file ~ . Only available if compiled with UNIXBACKUP defined.

-C

Ignore case when matching filenames. Useful on non-Unix systems where filesystems are not case-sensitive.

-j

"Junk" paths. Extract all files in the current extraction directory, instead of reproducing the directory tree structure stored in the archive.

-L

Convert filenames to lowercase from archives created on uppercase-only systems. By default, filenames are extracted exactly as stored in the archive.

-M

Pipe output through the internal pager, which is similar to more . Press the Return key or spacebar at the --More-- prompt to see the next screenful.

-n

Never overwrite existing files. If a file already exists, don't extract it, just continue on without prompting. Normally, unzip prompts for an action.

-o

Overwrite existing files without prompting. Often used together with -f . Use with care.

Examples

List the contents of a ZIP archive:

unzip -lv whizprog.zip

Extract C source files in the main directory, but not in subdirectories:

unzip whizprog.zip '*.[ch]' -x '*/*'


Previous: Reference: unix2dos UNIX in a Nutshell: System V Edition Next: Reference: uptime
Reference: unix2dos Book Index Reference: uptime

The UNIX CD Bookshelf NavigationThe UNIX CD BookshelfUNIX Power ToolsUNIX in a NutshellLearning the vi Editorsed & awkLearning the Korn ShellLearning the UNIX Operating System










??????????????@Mail.ru