📄 zip.1
字号:
.\" =========================================================================.\" Copyright (c) 1990-2006 Info-ZIP. All rights reserved..\".\" See the accompanying file LICENSE, version 2005-Feb-10 or later.\" (the contents of which are also included in zip.h) for terms of use..\" If, for some reason, all these files are missing, the Info-ZIP license.\" also may be found at: ftp://ftp.info-zip.org/pub/infozip/license.html.\" ==========================================================================.\".\" zip.1 by Mark Adler, Jean-loup Gailly and R. P. C. Rodgers.\".TH ZIP 1L "19 June 2006 (v2.32)" Info-ZIP.SH NAMEzip, zipcloak, zipnote, zipsplit \- package and compress (archive) files.SH SYNOPSIS.B zip.RB [ \-aABcdDeEfFghjklLmoqrRSTuvVwXyz!@$ ].RB [ \-b\ path ].RB [ \-n\ suffixes ].RB [ \-t\ mmddyyyy ].RB [ \-tt\ mmddyyyy ].I [ zipfile.I [ file1.IR file2 " .\|.\|." ]].RB [ \-xi\ list ].PP.B zipcloak.RB [ \-dhL ].RB [ \-b\ path ].I zipfile.PP.B zipnote.RB [ \-hwL ].RB [ \-b\ path ].I zipfile.PP.B zipsplit.RB [ \-hiLpst ].RB [ \-n\ size ].RB [ \-b\ path ].I zipfile.SH DESCRIPTION.I zipis a compression and file packaging utility for Unix, VMS, MSDOS,OS/2, Windows NT, Minix, Atari and Macintosh, Amiga and Acorn RISC OS..LPIt is analogous to a combination of the UNIX commands.IR tar (1)and.IR compress (1)and is compatible with PKZIP (Phil Katz's ZIP for MSDOS systems)..LPA companion program.RI ( unzip (1L)),unpacks.I ziparchives.The.I zipand.IR unzip (1L)programs can work with archives produced by PKZIP,and PKZIP and PKUNZIP can work with archives produced by.IR zip ..I zipversion 2.32 is compatible with PKZIP 2.04.Note that PKUNZIP 1.10 cannot extract files produced by PKZIP 2.04or.I zip2.32. You must use PKUNZIP 2.04g or.I unzip5.0p1 (or later versions) to extract them..PPFor a brief help on \fIzip\fR and \fIunzip\fR,run each without specifying any parameters on the command line..PPThe program is useful for packaging a set of files for distribution;for archiving files;and for saving disk space by temporarilycompressing unused files or directories..LPThe.I zipprogram puts one or more compressed files into a single.I ziparchive,along with information about the files(name, path, date, time of last modification, protection,and check information to verify file integrity).An entire directory structure can be packed into a.I ziparchive with a single command.Compression ratios of 2:1 to 3:1 are common for text files..I ziphas one compression method (deflation) and can also store files withoutcompression..I zipautomatically chooses the better of the two for each file to be compressed..LPThe basic command format is.IP\fBzip\fR options archive inpattern inpattern ....LPwhere \fBarchive\fR is a new or existing \fIzip\fR archive and \fBinpattern\fR is a directory or file path optionally including wildcards.When given the name of an existing.I ziparchive,.I zipwill replace identically named entries in the.I ziparchive or add entries for new names.For example,if.I foo.zipexists and contains.I foo/file1and.IR foo/file2 ,and the directory.I foocontains the files.I foo/file1and.IR foo/file3 ,then:.IP\fCzip -r foo.zip foo\fP.LPor more concisely.IP\fCzip -r foo foo\fP.LPwill replace.I foo/file1in.I foo.zipand add.I foo/file3to.IR foo.zip .After this,.I foo.zipcontains.IR foo/file1 ,.IR foo/file2 ,and.IR foo/file3 ,with.I foo/file2unchanged from before..LPIf the file list is specified as.BR \-@ ,[Not on MacOS].I ziptakes the list of input files from standard input.Under UNIX,this option can be used to powerful effect in conjunction with the.IR find (1)command.For example,to archive all the C source files in the current directory andits subdirectories:.IP\fCfind . -name "*.[ch]" -print | zip source -@\fP.LP(note that the pattern \fB"*.[ch]"\fR must be quoted to keep the shell fromexpanding it)..I zipwill also accept a single dash ("-") as the zip file name, in which case itwill write the zip file to standard output, allowing the output to be pipedto another program. For example:.IP\fCzip -r - . | dd of=/dev/nrst0 obs=16k\fP.LPwould write the zip output directly to a tape with the specified block sizefor the purpose of backing up the current directory..LP.I zipalso accepts a single dash ("-") as the name of a file to be compressed, inwhich case it will read the file from standard input, allowing zip to takeinput from another program. For example:.IP\fCtar cf - . | zip backup -\fP.LPwould compress the output of the tar command for the purpose of backing upthe current directory. This generally produces better compression thanthe previous example using the.B \-roption, because.I zipcan take advantage of redundancy between files. The backup can be restoredusing the command.IP\fCunzip -p backup | tar xf -\fP.LPWhen no zip file name is given and stdout is not a terminal,.I zipacts as a filter, compressing standard input to standard output.For example,.IP\fCtar cf - . | zip | dd of=/dev/nrst0 obs=16k\fP.LPis equivalent to.IP\fCtar cf - . | zip - - | dd of=/dev/nrst0 obs=16k\fP.LP.I ziparchives created in this manner can be extracted with the program.I funzipwhich is provided in the.I unzippackage, or by.I gunzipwhich is provided in the.I gzippackage. For example:.IP\fCdd if=/dev/nrst0 ibs=16k | funzip | tar xvf -\fP.LPWhen changing an existing.I ziparchive,.I zipwill write a temporary file with the new contents,and only replace the old one when the process of creating the new versionhas been completed without error..LPIf the name of the.I ziparchive does not contain an extension, the extension.IR .zipis added. If the name already contains an extension other than.IR .zipthe existing extension is kept unchanged..SH "OPTIONS".TP.BI \-a[Systems using EBCDIC] Translate file to ASCII format..TP.BI \-AAdjust self-extracting executable archive.A self-extracting executable archive is created by prependingthe SFX stub to an existing archive. The.B \-Aoption tells.I zipto adjust the entry offsets storedin the archive to take into account this "preamble" data..LPNote: self-extracting archives for the Amiga are a special case.At present, only the Amiga port of \fIzip\fR is capable of adjustingor updating these without corrupting them..B \-Jcan be used to remove the SFX stub if other updates need to be made..TP.BI \-B[VM/CMS and MVS] force file to be read binary (default is text)..TP.BI \-Bn[TANDEM] set Edit/Enscribe formatting options with n defined as.RSbit 0: Don't add delimiter (Edit/Enscribe).RE.RSbit 1: Use LF rather than CR/LF as delimiter (Edit/Enscribe).RE.RSbit 2: Space fill record to maximum record length (Enscribe).RE.RSbit 3: Trim trailing space (Enscribe).RE.RSbit 8: Force 30K (Expand) large read for unstructured files.RE.TP.BI \-b\ pathUse the specified.I pathfor the temporary.I ziparchive. For example:.RS.IP\fCzip -b /tmp stuff *\fP.RE.IPwill put the temporary.I ziparchive in the directory.IR /tmp ,copying over.I stuff.zipto the current directory when done. This option is only useful whenupdating an existing archive, and the file system containing thisold archive does not have enough space to hold both old and new archivesat the same time..TP.B \-cAdd one-line comments for each file.File operations (adding, updating) are done first,and the user is then prompted for a one-line comment for each file.Enter the comment followed by return, or just return for no comment..TP.B \-dRemove (delete) entries from a.I ziparchive.For example:.RS.IP\fCzip -d foo foo/tom/junk foo/harry/\\* \\*.o\fP.RE.IPwill remove the entry.IR foo/tom/junk ,all of the files that start with.IR foo/harry/ ,and all of the files that end with.I \&.o(in any path).Note that shell pathname expansion has been inhibited with backslashes,so that.I zipcan see the asterisks,enabling.I zipto match on the contents of the.I ziparchive instead of the contents of the current directory.You can also use quotes to escape wildcards, as in.RS.IP\fCzip -d foo foo/tom/junk "foo/harry/*" "*.o"\fP.RE.IPUnder systems where the shell does not expand wildcards, such as MSDOS,the backslashes are not needed. The above would then be.RS.IP\fCzip -d foo foo/tom/junk foo/harry/* *.o\fP.RE.IPUnder MSDOS,.B \-dis case sensitive when it matches names in the.I ziparchive.This requires that file names be entered in upper case if they werezipped by PKZIP on an MSDOS system..TP.B \-df[MacOS] Include only data-fork of files zipped into the archive.Good for exporting files to foreign operating-systems.Resource-forks will be ignored at all..TP.B \-DDo not create entries in the ziparchive for directories. Directory entries are created by default so thattheir attributes can be saved in the zip archive.The environment variable ZIPOPT can be used to change the default options. Forexample under Unix with sh:.RS.IPZIPOPT="-D"; export ZIPOPT.RE.IP(The variable ZIPOPT can be used for any option except.B \-iand.B \-xand can include several options.) The option.B \-Dis a shorthandfor.B \-x"*/" but the latter cannot be set as default in the ZIPOPT environmentvariable..TP.B \-eEncrypt the contents of the ziparchive using a password which is entered on the terminal in responseto a prompt(this will not be echoed; if standard error is not a tty,.I zipwill exit with an error).The password prompt is repeated to save the user from typing errors.Note that this encrypts with standard pkzip encryption which is consideredweak..TP.B \-E[OS/2] Use the .LONGNAME Extended Attribute (if found) as filename..TP.B \-fReplace (freshen) an existing entry in the.I ziparchive only if it has been modified more recently than theversion already in thearchive;unlike the update option.RB ( \-u )this will not add files that are not already in the.I ziparchive.For example:.RS.IP\fCzip -f foo\fP.RE.IPThis command should be run from the same directory from which the original.I zipcommand was run,since paths stored in.I ziparchives are always relative..IPNote that the timezone environment variable TZ should be set according tothe local timezone in order for the.B \-f,.B \-uand.B \-ooptions to work correctly.The reasons behind this are somewhat subtle but have to do with the differencesbetween the Unix-format file times (always in GMT) and most of the otheroperating systems (always local time) and the necessity to compare the two.A typical TZ value is ``MET-1MEST'' (Middle European time with automaticadjustment for ``summertime'' or Daylight Savings Time)..TP.B \-FFix the.I ziparchive. This option can be used if some portions of the archiveare missing. It is not guaranteed to work, so you MUST make a backupof the original archive first..IPWhen doubled as in.B \-FFthe compressed sizes given inside the damaged archive are not trustedand zip scans for special signatures to identify the limits betweenthe archive members. The single.B \-Fis more reliable if the archive is not too much damaged, for exampleif it has only been truncated, so try this option first..IPNeither option will recover archives that have been incorrectlytransferred in ascii mode instead of binary. After the repair, the.B \-toption of.I unzipmay show that some files have a bad CRC. Such files cannot be recovered;you can remove them from the archive using the.B \-d
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -