Typically one uses tar to create an uncompressed archive and either gzip or bzip2 to compress that archive. The corresponding gunzip and bunzip2 commands can be used to uncompress said archive, or you can just use flags on the tar command to perform the uncompression.
how to uncompress a zip file in unix
7z doesn't create archives with full filesystem information on UNIX, so you'd need to use tar before using 7z (but since 7z stores other information about the tar file, I'd recommend using xz, as it is designed for it):
Unlike cpio and POSIX tar, but like GNU tar, pax is able to both archive files and compress the archive. This behavior is different from zip, which compresses each file before putting it in the archive.
I often find myself trying to zip the modified files in my work directory -- either to copy all the modified files to another sandbox work directory or to preserve them for a short while because I want to undo some of the changes.
This Linux program is compatible with the zip program for Windows and most other operating systems. To zip files, first have the files uploaded to your server, then log into your account with SSH. Navigate to the directory where the files are that you want to zip (for instance by typing cd www then cd sounds to move to your /www/sounds directory). Then type:
tar is an acronym for Tape Archive. tar command is used toManipulates archives in Linux/Unix. System administrators uses tarcommand frequently to rip a bunch of files or directories into highlycompressed archive which are called tarball or tar, bzip andgzip in Linux/Unix system.
unzip --q[other options] zipfileThe first hyphen is the normalswitch character, and the second is a minus sign, acting on the q option.Thus the effect here is to cancel one quantum of quietness. To cancelboth quiet flags, two (or more) minuses may be used:unzip -t--q zipfileunzip ---qt zipfile(the two are equivalent). This may seem awkwardor confusing, but it is reasonably intuitive: just ignore the firsthyphen and go from there. It is also consistent with the behavior ofUnix nice(1).As suggested by the examples above, the default variable names are UNZIP_OPTSfor VMS (where the symbol used to install unzip as a foreign commandwould otherwise be confused with the environment variable), and UNZIPfor all other operating systems. For compatibility with zip(1L),UNZIPOPT is also accepted (don’t ask). If both UNZIP and UNZIPOPTare defined, however, UNZIP takes precedence. unzip’s diagnosticoption (-v with no zipfile name) can be used to check the valuesof all four possible unzip and zipinfo environment variables.The timezone variable (TZ) should be set according to the local timezonein order for the -f and -u to operate correctly. See thedescription of -f above for details. This variable may also benecessary to get timestamps of extracted files to be set correctly.The WIN32 (Win9x/ME/NT4/2K/XP/2K3) port of unzip gets the timezoneconfiguration from the registry, assuming it is correctly set in theControl Panel. The TZ variable is ignored for this port.DECRYPTIONEncrypted archives are fully supported by Info-ZIP software, but due toUnited States export restrictions, de-/encryption support might be disabledin your compiled binary. However, since spring 2000, US export restrictionshave been liberated, and our source archives do now include full crypt code.In case you need binary distributions with crypt support enabled, see thefile ‘‘WHERE’’ in any Info-ZIP source or binary distribution for locationsboth inside and outside the US.Some compiled versions of unzip may not support decryption.To check a version for crypt support, either attempt to test or extractan encrypted archive, or else check unzip’s diagnosticscreen (see the -v option above) for ‘‘[decryption]’’ as oneof the special compilation options.As noted above, the -P option may be used to supply a password onthe command line, but at a cost in security. The preferred decryptionmethod is simply to extract normally; if a zipfile member is encrypted,unzip will prompt for the password without echoing what is typed.unzip continues to use the same password as long as it appears to bevalid, by testing a 12-byte header on each file. The correct password willalways check out against the header, but there is a 1-in-256 chance that anincorrect password will as well. (This is a security feature of the PKWAREzipfile format; it helps prevent brute-force attacks that might otherwisegain a large speed advantage by testing only the header.) In the case thatan incorrect password is given but it passes the header test anyway, eitheran incorrect CRC will be generated for the extracted data or else unzipwill fail during the extraction because the ‘‘decrypted’’ bytes do notconstitute a valid compressed data stream.If the first password fails the header check on some file, unzip willprompt for another password, and so on until all files are extracted. Ifa password is not known, entering a null password (that is, just a carriagereturn or ‘‘Enter’’) is taken as a signal to skip all further prompting.Only unencrypted files in the archive(s) will thereafter be extracted. (Infact, that’s not quite true; older versions of zip(1L) andzipcloak(1L) allowed null passwords, so unzip checks each encryptedfile to see if the null password works. This may result in ‘‘false positives’’and extraction errors, as noted above.)Archives encrypted with 8-bit passwords (for example, passwords with accentedEuropean characters) may not be portable across systems and/or otherarchivers. This problem stems from the use of multiple encoding methods forsuch characters, including Latin-1 (ISO 8859-1) and OEM code page 850. DOSPKZIP 2.04g uses the OEM code page; Windows PKZIP 2.50 usesLatin-1 (and is therefore incompatible with DOS PKZIP); Info-ZIP usesthe OEM code page on DOS, OS/2 and Win3.x ports but Latin-1 everywhereelse; and Nico Mak’s WinZip 6.x does not allow 8-bit passwords at all.UnZip 5.3 (or newer) attempts to use the default character set first(e.g., Latin-1), followed by the alternate one (e.g., OEM code page) to testpasswords. On EBCDIC systems, if both of these fail, EBCDIC encoding willbe tested as a last resort. (EBCDIC is not tested on non-EBCDIC systems,because there are no known archivers that encrypt using EBCDIC encoding.)ISO character encodings other than Latin-1 are not supported.EXAMPLESTo use unzip to extract all members of the archive letters.zipinto the current directory and subdirectories below it, creating anysubdirectories as necessary:unzip lettersTo extract all members of letters.zip into the current directory only:unzip -j lettersTo test letters.zip, printing only a summary message indicatingwhether the archive is OK or not:unzip -tq lettersTo test all zipfiles in the current directory, printing only thesummaries:unzip -tq \*.zip(The backslash before the asterisk is only required if the shell expandswildcards, as in Unix; double quotes could have been used instead, as inthe source examples below.) To extract to standard output all members ofletters.zip whose names end in .tex, auto-converting to thelocal end-of-line convention and piping the output into more(1):unzip -ca letters \*.tex moreTo extract the binary file paper1.dvi to standard output and pipe itto a printing program:unzip -p articles paper1.dvi dvipsTo extract all FORTRAN and C source files--*.f, *.c, *.h, and Makefile--intothe /tmp directory:unzip source.zip "*.[fch]" Makefile -d /tmp(the double quotes are necessary only in Unix and only if globbing is turnedon). 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 source.zip "*.[fch]" makefile -d /tmpTo extract any such files but convert any uppercase MS-DOS or VMS names tolowercase and convert the line-endings of all of the files to the localstandard (without respect to any files that might be marked ‘‘binary’’):unzip -aaCL source.zip "*.[fch]" makefile -d /tmpTo extract only newer versions of the files already in the currentdirectory, without querying (NOTE: be careful of unzipping in one timezone azipfile created in another--ZIP archives other than those created by Zip 2.1or later contain no timezone information, and a ‘‘newer’’ file from an easterntimezone may, in fact, be older):unzip -fo sourcesTo extract newer versions of the files already in the current directory andto create any files not already there (same caveat as previous example):unzip -uo sourcesTo display a diagnostic screen showing which unzip and zipinfooptions are stored in environment variables, whether decryption support wascompiled in, the compiler with which unzip was compiled, etc.:unzip -vIn the last five examples, assume that UNZIP or UNZIP_OPTS is set to -q.To do a singly quiet listing:unzip -l file.zipTo do a doubly quiet listing:unzip -ql file.zip(Note that the ‘‘.zip’’ is generally not necessary.) To do a standardlisting:unzip --ql file.ziporunzip -l-q file.ziporunzip -l--q file.zip(Extra minuses in options don’t hurt.)TIPSThe current maintainer, being a lazy sort, finds it very useful to definea pair of aliases: tt for ‘‘unzip -tq’’ and ii for‘‘unzip -Z’’ (or ‘‘zipinfo’’). One may then simply type‘‘tt zipfile’’ to test an archive, something that is worth making ahabit of doing. With luck unzip will report ‘‘No errors detectedin compressed data of zipfile.zip,’’ after which one may breathe a sighof relief.The maintainer also finds it useful to set the UNZIP environment variableto ‘‘-aL’’ and is tempted to add ‘‘-C’’ as well. His ZIPINFOvariable is set to ‘‘-z’’.DIAGNOSTICSThe exit status (or error level) approximates the exit codes defined by PKWAREand takes on the following values, except under VMS:TagDescription0normal; no errors or warnings detected.1one or more warning errors were encountered, but processing completedsuccessfully anyway. This includes zipfiles where one or more fileswas skipped due to unsupported compression method or encryption with anunknown password.2a generic error in the zipfile format was detected. Processing may havecompleted successfully anyway; some broken zipfiles created by otherarchivers have simple work-arounds.3a severe error in the zipfile format was detected. Processing probablyfailed immediately.4unzip was unable to allocate memory for one or more buffers duringprogram initialization.5unzip was unable to allocate memory or unable to obtain a tty to readthe decryption password(s).6unzip was unable to allocate memory during decompression to disk.7unzip was unable to allocate memory during in-memory decompression.8[currently not used]9the specified zipfiles were not found.10invalid options were specified on the command line.11no matching files were found.50the disk is (or was) full during extraction.51the end of the ZIP archive was encountered prematurely.80the user aborted unzip prematurely with control-C (or similar)81testing or extraction of one or more files failed due to unsupportedcompression methods or unsupported decryption.82no files were found due to bad decryption password(s). (If even one file issuccessfully processed, however, the exit status is 1.)VMS interprets standard Unix (or PC) return values as other, scarier-lookingthings, so unzip instead maps them into VMS-style status codes. Thecurrent mapping is as follows: 1 (success) for normal exit, 0x7fff0001for warning errors, and (0x7fff000? + 16*normal_unzip_exit_status) for allother errors, where the ‘?’ is 2 (error) for unzip values 2, 9-11 and80-82, and 4 (fatal error) for the remaining ones (3-8, 50, 51). In addition,there is a compilation option to expand upon this behavior: definingRETURN_CODES results in a human-readable explanation of what the errorstatus means.BUGSMulti-part archives are not yet supported, except in conjunction withzip. (All parts must be concatenated together in order, and then‘‘zip -F’’ must be performed on the concatenated archive in orderto ‘‘fix’’ it.) This will definitely be corrected in the next major release.Archives read from standard input are not yet supported, except withfunzip (and then only the first member of the archive can be extracted).Archives encrypted with 8-bit passwords (e.g., passwords with accentedEuropean characters) may not be portable across systems and/or otherarchivers. See the discussion in DECRYPTION above.unzip’s -M (‘‘more’’) option tries to take into account automaticwrapping of long lines. However, the code may fail to detect the correctwrapping locations. First, TAB characters (and similar control sequences) arenot taken into account, they are handled as ordinary printable characters.Second, depending on the actual system / OS port, unzip may not detectthe true screen geometry but rather rely on "commonly used" default dimensions.The correct handling of tabs would require the implementation of a query forthe actual tabulator setup on the output console.Dates, times and permissions of stored directories are not restored exceptunder Unix. (On Windows NT and successors, timestamps are now restored.)[MS-DOS] When extracting or testing files from an archive on a defectivefloppy diskette, if the ‘‘Fail’’ option is chosen from DOS’s ‘‘Abort, Retry,Fail?’’ message, older versions of unzip may hang the system, requiringa reboot. This problem appears to be fixed, but control-C (or control-Break)can still be used to terminate unzip.Under DEC Ultrix, unzip would sometimes fail on long zipfiles (bad CRC,not always reproducible). This was apparently due either to a hardware bug(cache memory) or an operating system bug (improper handling of page faults?).Since Ultrix has been abandoned in favor of Digital Unix (OSF/1), this may notbe an issue anymore.[Unix] Unix special files such as FIFO buffers (named pipes), block devicesand character devices are not restored even if they are somehow representedin the zipfile, nor are hard-linked files relinked. Basically the only filetypes restored by unzip are regular files, directories and symbolic(soft) links.[OS/2] Extended attributes for existing directories are only updated if the-o (‘‘overwrite all’’) option is given. This is a limitation of theoperating system; because directories only have a creation time associatedwith them, unzip has no way to determine whether the stored attributesare newer or older than those on disk. In practice this may mean a two-passapproach is required: first unpack the archive normally (with or withoutfreshening/updating existing files), then overwrite just the directory entries(e.g., ‘‘unzip -o foo */’’).[VMS] When extracting to another directory, only the [.foo] syntax isaccepted for the -d option; the simple Unix foo syntax issilently ignored (as is the less common VMS foo.dir syntax).[VMS] When the file being extracted already exists, unzip’s query onlyallows skipping, overwriting or renaming; there should additionally be achoice for creating a new version of the file. In fact, the ‘‘overwrite’’choice does create a new version; the old version is not overwritten ordeleted.SEE ALSOzipinfo(1L), zipnote(1L), zipsplit(1L)URLThe Info-ZIP home page is currently at -zip.org/pub/infozip/or -zip.org/pub/infozip/ .AUTHORSThe primary Info-ZIP authors (current semi-active members of the Zip-Bugsworkgroup) are: Ed Gordon (Zip, general maintenance, shared code, Zip64,Win32, Unix); Christian Spieler (UnZip maintenance coordination, VMS, MS-DOS,Win32, shared code, general Zip and UnZip integration and optimization);Onno van der Linden (Zip); Mike White (Win32, Windows GUI, Windows DLLs);Kai Uwe Rommel (OS/2, Win32); Steven M. Schweda (VMS, support of new features);Paul Kienitz (Amiga, Win32); Chris Herborth (BeOS, QNX, Atari); Jonathan Hudson(SMS/QDOS); Sergio Monesi (Acorn RISC OS); Harald Denker (Atari, MVS);John Bush (Solaris, Amiga); Hunter Goatley (VMS, Info-ZIP Site maintenance);Steve Salisbury (Win32); Steve Miller (Windows CE GUI), Johnny Lee (MS-DOS,Win32, Zip64); and Dave Smith (Tandem NSK).The following people were former members of the Info-ZIP development groupand provided major contributions to key parts of the current code:Greg ‘‘Cave Newt’’ Roelofs (UnZip, unshrink decompression);Jean-loup Gailly (deflate compression);Mark Adler (inflate decompression, fUnZip).The author of the original unzip code upon which Info-ZIP’s was basedis Samuel H. Smith; Carl Mascott did the first Unix port; and David P.Kirschbaum organized and led Info-ZIP in its early days with Keith Petersenhosting the original mailing list at WSMR-SimTel20. The full list ofcontributors to UnZip has grown quite large; please refer to the CONTRIBSfile in the UnZip source distribution for a relatively complete version.VERSIONSTagDescriptionv1.2 15 Mar 89Samuel H. Smithv2.0 9 Sep 89Samuel H. Smithv2.x fall 1989many Usenet contributorsv3.0 1 May 90Info-ZIP (DPK, consolidator)v3.1 15 Aug 90Info-ZIP (DPK, consolidator)v4.0 1 Dec 90Info-ZIP (GRR, maintainer)v4.1 12 May 91Info-ZIPv4.2 20 Mar 92Info-ZIP (Zip-Bugs subgroup, GRR)v5.0 21 Aug 92Info-ZIP (Zip-Bugs subgroup, GRR)v5.0115 Jan 93Info-ZIP (Zip-Bugs subgroup, GRR)v5.1 7 Feb 94Info-ZIP (Zip-Bugs subgroup, GRR)v5.11 2 Aug 94Info-ZIP (Zip-Bugs subgroup, GRR)v5.1228 Aug 94Info-ZIP (Zip-Bugs subgroup, GRR)v5.2 30 Apr 96Info-ZIP (Zip-Bugs subgroup, GRR)v5.3 22 Apr 97Info-ZIP (Zip-Bugs subgroup, GRR)v5.3131 May 97Info-ZIP (Zip-Bugs subgroup, GRR)v5.32 3 Nov 97Info-ZIP (Zip-Bugs subgroup, GRR)v5.4 28 Nov 98Info-ZIP (Zip-Bugs subgroup, SPC)v5.4116 Apr 00Info-ZIP (Zip-Bugs subgroup, SPC)v5.4214 Jan 01Info-ZIP (Zip-Bugs subgroup, SPC)v5.5 17 Feb 02Info-ZIP (Zip-Bugs subgroup, SPC)v5.5122 May 04Info-ZIP (Zip-Bugs subgroup, SPC)v5.5228 Feb 05Info-ZIP (Zip-Bugs subgroup, SPC) Advertisements 2ff7e9595c
Comentarios