Log in Go to the main page Page Discussion History Go to the file list Go to the site toolbox

Unzip command

From NetworkCommands


Image:Tux_64x64.png

A command available on Linux platforms; used to test the integrity of and display and extract the contents of existing Zip archives.

Contents

Image:Vm-power-on-medium.png Usage Syntax

unzip [options] file-list [-d directory] [-x file-list]

Common options include;

  • -f - 'freshen' existing files; extract only those files that already exist on disk and that are more recent than those files on disk
  • -u - as -f but also extract files that do not already exist on disk
  • -B - save a backup copy of each file overwritten, with a tilde appended (only if compiled with UNIXBACKUP defined)
  • -j - junk paths; extract all files to current or specified (with -d) directory, ignoring the archive's directory structure
  • -n - never overwrite existing files
  • -l - list files in archive(s)
  • -t - test integrity of archive(s)

file-list - specify one or more zip archive files, separate multiple file names with spaces

-d directory - extract files to specified directory (default is to current directory)

-x file-list - exclude the specified file or files from processing by unzip

Image:Vm-power-on-medium.png Usage Examples

unzip /etc/test - extract files (and file directory structure) from archive /etc/test.zip to the current directory

unzip -j test -d /test/temp/ - extract files from archive test.zip to the current directory, ignoring the archive's directory structure

unzip -n test* -x test8 - extract files (and file directory structure) from all archives with filenames starting test with the exception of archive test8.zip

Image:accessories-text-editor-v2-medium.png Usage Notes

Unless the -d option is used files are extracted to the current directory

The .zip extension does not need to be specified

Basic regular expression operators and character sets can be used for file names, these are *, ? and [...]. See our Regular Expressions Guide for more information on regular expression use and syntax

Image:accessories-text-editor-v2-medium.png Linux Usage Notes

With most Linux or Unix commands;

  • Brief help can be displayed using the option/keyword: -h or --help, for example: chmod --help
  • A full command manual can be displayed using the man command followed by the command name, for example: man chmod
  • Sometimes 'info' pages are used instead of or to provide more information than man pages; for example: info chmod
  • Version information can be display using the option/keyword: -v or --version, for example: chmod --version


Image:emblem-package-medium.png Installation

Zip and unzip can be installed or upgraded as follows, depending on your platform;

  • Ubuntu: apt-get install zip
  • Fedora Core: yum install zip
  • FreeBSD: pkg_add -v -r zip

Image:icemon-medium.png Related Commands

Use the zipinfo command to display information about existing zip files.

See the 7z command, zip command, tar command and unrar command articles for information on other file compression utilities available under Linux.

Image:icemon-medium.png Related Articles

Information on other Linux commands Image:Tux-small.png

Information on Cisco commands Image:Cisco-logo-small.png

Information on Vyatta commands Image:Vyatta-logo-small.png

Information on Extreme commands Image:Extreme-logo-small.png

Information on F5 BigIP commands Image:F5-logo-small.png

Information on Blue Coat SGOS commands

Information on Nokia IPSO commands


Image:internet-group-chat-small.png We really do appreciate all feedback so please do send your comments, suggestions or corrections to steve#networkstuff.eu (replacing the # with an @)



Site Toolbox:

Personal tools
This page was last modified on 9 August 2008, at 08:05. - This page has been accessed 27 times. - Disclaimers - About NetworkCommands
Powered by MediaWiki