Extract ZIP files in Linux

ZIP archives are most commonly used in Windows/MS-DOS based environments.

In Linux, you can use the “unzip” command to extract,list or test ZIP files. Below are the common tasks I use “unzip” for.

Extract the contents of a ZIP file into it’s own directory and also create subdirectories as needed.

# unzip [filename].zip

Extract the contents of a ZIP file into the current directory only. No subdirectories will be created.

# unzip -j [filename].zip

Extract the contents of a ZIp file into a custom directory.

# unzip -d [target directory] [filename].zip

List the contents of a ZIP file.

# unzip -l [filename].zip

Test the integrity of a ZIP file and it’s contents.

 # unzip -t [filename].zip

# unzip -tq [filename].zip (Only shows summary)

Extract the contents of a ZIP file only if the files already exist in the target directory. Good for upgrades.

# unzip -f [filename].zip

# unzip -fo [filename].zip (non interactive. Yes to all)

Extract the contents of a ZIP file if the contents are newer then what’s available in the target directory or don’t exist yet. Good for upgrades.

# unzip -u [filename].zip

# unzip -uo [filename].zip (non interactive. Yes to all)

Did this help? If you need further information please drop me a comment.

  • Pingback: PFWD : blog.peterfisher.me.uk : Unzip comand example :

  • ilho

    thanks

  • Minio

    How can unzip only the subdirectory e.g.:

    I have the zipped file xx.zip that contain:

    pippo/pluto/mickey

    I can extract only “pluto/mickey”

    Thanks in advance
    Minio

© 2008-2012 The Danesh Project
Powered by Wordpress and made by Guerrilla. Hosted at ServerFreak