Unzipping Zipped Files with unzip

Unzipping Zipped Files with unzip

You can unzip zipped files using unzip, which is logical because you certainly wouldn't unzip zipped files with unVelcro or unsnap (Code Listing 13.13).

To Unzip a Zip File Using unzip:


ls -l *.zip

At the shell prompt, verify the name of the zip file with ls *.zip.


unzip zipped.zip

Enter unzip and the name of the file to unzip (with or without the .zip extension).unzip will uncompress the file(s) and return you to the shell prompt.


  • If you attempt to unzip a file and the file or files to be unzipped already exist, unzip will prompt you for each one to determine if you want to overwrite (destroy) the existing file, cancel the unzipping process, or rename the file you're unzipping to a safe name. Alternatively, use the -n (never overwrite) or -o (always overwrite) flags to avoid this prompt entirely.

  • gunzip also understands how to uncompress some .zip files, so you can use gunzip instead of unzip, if you'd like. On the Unix side of things, use whatever seems easiest to you, or gunzip if you really don't care. If you're providing files to Windows users, zip is somewhat more reliable because the format it creates is more standard.

Code Listing 13.13. unzip lets you uncompress files without accidentally obliterating them.

[ejr@hobbes compression]$ ls -l *.zip -rw-rw-r-     1 ejr   users    268156 Jul 23 06:53 folderzip.zip -rw-rw-r-     1 ejr   users    55124 Jul 23 06:38 fortunes1.zip -rw-rw-r-     1 ejr   users    53792 Jul 23 06:52 newzip.zip -rw-r-r-      1 ejr   users    239943 Jul 27 10:41 zipped.zip [ejr@hobbes compression]$ unzip zipped.zip Archive:  zipped.zip replace zipadeedoodah.tar? [y]es, [n]o, [A]ll, [N]one, [r]ename: y    inflating: zipadeedoodah.tar [ejr@hobbes compression]$ 

Unix(c) Visual Quickstart Guide
UNIX, Third Edition
ISBN: 0321442458
EAN: 2147483647
Year: 2006
Pages: 251

Similar book on Amazon

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net