Unzip command
From NetworkCommands
A command available on Linux platforms; used to test the integrity of and display and extract the contents of existing Zip archives.
Contents |
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
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
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
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
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
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.
Related Articles
Information on other Linux commands
Information on Cisco commands
Information on Vyatta commands
Information on Extreme commands
Information on F5 BigIP commands
Information on Blue Coat SGOS commands
Information on Nokia IPSO commands







