Example Uses of the Linux Command Unzip

Embed Size (px)

Citation preview

  • 7/27/2019 Example Uses of the Linux Command Unzip

    1/3

    8/21/13 Example uses of the Linux Command unzip

    linux.about.com/od/commands/a/blcmdl1_unzipx.htm 1/3

    Linux

    Rs.699

    Adidas Men Black

    Adi Rio Flip Flops

    Computing

    Share

    By Juergen Haas, About.com Guide

    Example uses of the Linux Command zipAn Introductory Tutorial

    The following examples illustrate typical uses of the command unzip for unpackaging "archive" files, also called "zip files". The archive files are assumed

    to be generated using software such as zip, which uses the s tandard z ip file format.

    To use unzip to extract all members of the archive letters.zip into the current directory and subdirectories below it, creating any subdirectories as

    necessary:

    unzip letters

    To extract all members ofletters.zip into the current d irectory only:

    unzip -j letters

    To test letters.zip, printing only a summary message indicating whether the a rchive is OK or not:

    unzip -tq letters

    To test allzipfiles in the current d irectory, printing only the summaries:

    unzip -tq \*.zip

    (The backslash be fore the as terisk is only required if the shell expands w ildcards, as in Unix; double quotes could have been used instead, as in the

    source examples below .) To extract to standard output all members ofletters.zipwhose 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

    Enter email address

    Free Linux Newsletter!

    Discuss in my forum

    Sign Up

    http://linux.about.com/od/commands/a/blcmdl1_unzipx.htm?p=1http://forums.about.com/n/pfx/forum.aspx?nav=messages&webtag=ab-linuxhttp://linux.about.com/library/cmd/blcmdl1_more.htmhttp://linux.about.com/od/commands/l/blcmdl1_zip.htmhttp://linux.about.com/od/commands/l/blcmdl1_unzip.htmhttp://linux.about.com/bio/Juergen-Haas-9193.htmhttp://linux.about.com/od/commands/a/blcmdl1_unzipx.htm?p=1http://linux.about.com/gi/pages/shareurl.htm?PG=http%3a%2f%2flinux%2eabout%2ecom%2fod%2fcommands%2fa%2fblcmdl1%5funzipx%2ehtm&zItl=Example%20Uses%20of%20ziphttp://www.about.com/http://www.about.com/compute/http://sin1.g.adnxs.com/click?KVyPwvUo3D8pXI_C9SjcP83MzMzMzPQ_8kOlETP73T_yQ6URM_vdP4ltNCS_Pe4WAu00BGOkkmUyBRVSAAAAAPdAAAC1AAAAVwMAAAIAAABpWFUA0WMAAAAAAQBVU0QAVVNEANgCWgAGCdEBoIcBAgUCAQQAAAAASidANgAAAAA./cnd=%21OgYBOAjXmHEQ6bDVAhjRxwEgAA../referrer=http%3A%2F%2Flinux.about.com%2Fod%2Fcommands%2Fa%2Fblcmdl1_unzipx.htm/clickenc=http%3A%2F%2Fadclick.g.doubleclick.net%2Faclk%3Fsa%3Dl%26ai%3DCpghcMgUVUubIHMGKiAeHloHoD8OhtO8Cg53Fnzeb0-iVXhABIABQgMfhxARg5erjg5gOggEXY2EtcHViLTMzNDU5NjM1NzM3NDAyODWgAY3wx-IDyAEJ4AIAqAMBqgS3AU_Qpb7yoluVpfM1uw3GlY7k0mDapPFJQzvSUC8RI-IZn1oSv0PsZwbhcHbcPYwZfbyrHLNo4qflK6PYRGzNGN77a93zZ3F7KywU780dAlyudJl6dPJIRfM3x_GERGQGus4TQ0sxhAi87ETqZNc-WIQSwOYY4v2L0x3sc9OEPaZbwgeO84R9RyTCt1jBYhjAJnbc8iQROjxGV5aJPgl0T_ySdp2cakGbQ2dQlcn9kwbdoIf8FWfOBeAEAYAG37TkwveZl-3MAaAGIQ%26num%3D1%26sig%3DAOD64_3eQP6TMAQG_hBD113273fPiBgnzQ%26client%3Dca-pub-3345963573740285%26adurl%3Dhttp://www.myntra.com/Flip-Flops/Adidas/Adidas-Men-Black-Adi-Rio-Flip-Flops/108096/buy?utm_source=remarketing-ozone&utm_medium=cpa&utm_campaign=data-feedhttp://sin1.g.adnxs.com/click?KVyPwvUo3D8pXI_C9SjcP83MzMzMzPQ_8kOlETP73T_yQ6URM_vdP4ltNCS_Pe4WAu00BGOkkmUyBRVSAAAAAPdAAAC1AAAAVwMAAAIAAABpWFUA0WMAAAAAAQBVU0QAVVNEANgCWgAGCdEBoIcBAgUCAQQAAAAASidANgAAAAA./cnd=%21OgYBOAjXmHEQ6bDVAhjRxwEgAA../referrer=http%3A%2F%2Flinux.about.com%2Fod%2Fcommands%2Fa%2Fblcmdl1_unzipx.htm/clickenc=http%3A%2F%2Fadclick.g.doubleclick.net%2Faclk%3Fsa%3Dl%26ai%3DCpghcMgUVUubIHMGKiAeHloHoD8OhtO8Cg53Fnzeb0-iVXhABIABQgMfhxARg5erjg5gOggEXY2EtcHViLTMzNDU5NjM1NzM3NDAyODWgAY3wx-IDyAEJ4AIAqAMBqgS3AU_Qpb7yoluVpfM1uw3GlY7k0mDapPFJQzvSUC8RI-IZn1oSv0PsZwbhcHbcPYwZfbyrHLNo4qflK6PYRGzNGN77a93zZ3F7KywU780dAlyudJl6dPJIRfM3x_GERGQGus4TQ0sxhAi87ETqZNc-WIQSwOYY4v2L0x3sc9OEPaZbwgeO84R9RyTCt1jBYhjAJnbc8iQROjxGV5aJPgl0T_ySdp2cakGbQ2dQlcn9kwbdoIf8FWfOBeAEAYAG37TkwveZl-3MAaAGIQ%26num%3D1%26sig%3DAOD64_3eQP6TMAQG_hBD113273fPiBgnzQ%26client%3Dca-pub-3345963573740285%26adurl%3Dhttp://www.myntra.com/Flip-Flops/Adidas/Adidas-Men-Black-Adi-Rio-Flip-Flops/108096/buy?utm_source=remarketing-ozone&utm_medium=cpa&utm_campaign=data-feedhttp://linux.about.com/
  • 7/27/2019 Example Uses of the Linux Command Unzip

    2/3

    8/21/13 Example uses of the Linux Command unzip

    linux.about.com/od/commands/a/blcmdl1_unzipx.htm 2/3

    To extract the binary file paper1.dvito 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 source.zip "*.[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 source.zip "*.[fch]" makefile -d /tmp

    To extract any such files but convert any uppercase MS-DOS or VMS names to low ercase and convert the line-endings of all of the files to the local

    standard (without respect to any files tha t might be marked ``binary''):

    unzip -aaCL source.zip "*.[fch]" makefile -d /tmp

    To extract only newer versions of the files a lready in the current directory, without querying (NOTE: be careful of unzipping in one timezone a zipfilecreated 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 o lder):

    unzip -fo sources

    To extract newer versions o f the files a lready in the current directory and to create any files not a lready 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 compiledin, the compiler with which unzip was compiled, etc.:

    unzip -v

    In the last five examples, assume that UNZIP or UNZIP_OPTS is se t to -q. To do a singly quiet listing:

    unzip -l file.zip

    To do a doubly quiet listing:

    unzip -ql file.zip

  • 7/27/2019 Example Uses of the Linux Command Unzip

    3/3

    8/21/13 Example uses of the Linux Command unzip

    linux.about.com/od/commands/a/blcmdl1_unzipx.htm 3/3

    (Note that the ``.zip'' is generally not necessary.) To do a standard listing:

    unzip --ql file.zip

    or

    unzip -l-q file.zip

    or

    unzip -l--q file.zip

    (Extra minuses in options don't hurt.)

    Complete syntax of the command: zip

    Complete syntax of the command: unzip

    Top Related Searches Makefile Makefile Source Examples Directory Printing Summary Message Zipfiles Printing Program

    http://search.about.com/r.htm?q=printing%20programhttp://search.about.com/r.htm?q=zipfileshttp://search.about.com/r.htm?q=summary%20messagehttp://search.about.com/r.htm?q=directory%20printinghttp://search.about.com/r.htm?q=source%20exampleshttp://search.about.com/r.htm?q=makefile%20makefilehttp://linux.about.com/od/commands/l/blcmdl1_unzip.htmhttp://linux.about.com/od/commands/l/blcmdl1_zip.htm