Search notes:

Shell command: unzip

Specify destination directory

By default, unzip extracts the zipped files to the current directory. With -d, a specific directory can be specified:
unzip -d /home/rene/xyz  xyz.zip

Show a zip file's content

unzip -l xyz.zip

Merge the content of zip file into an already existing directory

-o forces overwriting of potentially already existing files.
unzip -o -d /home/rene/xyz  xyz.zip

Extract a given file or directory only

The following command extracts three.min.js (found in the archive under three.js-master/build/) to the «local» directory libraries.
$ unzip -j ~/Downloads/three.js-master.zip three.js-master/build/three.min.js -d libraries
The following command extracts the files found under the archive's pdf directory only.
unzip xyz.zip 'pdf/*' -d ~/dest
Note: the -j option (junk paths which is supposed to not create directories) still creates the pdf directory!

See also

Shell commands (such as zip)

Index

Fatal error: Uncaught PDOException: SQLSTATE[HY000]: General error: 8 attempt to write a readonly database in /home/httpd/vhosts/renenyffenegger.ch/php/web-request-database.php:78 Stack trace: #0 /home/httpd/vhosts/renenyffenegger.ch/php/web-request-database.php(78): PDOStatement->execute(Array) #1 /home/httpd/vhosts/renenyffenegger.ch/php/web-request-database.php(30): insert_webrequest_('/notes/Linux/sh...', 1745007689, '3.138.67.8', 'Mozilla/5.0 App...', NULL) #2 /home/httpd/vhosts/renenyffenegger.ch/httpsdocs/notes/Linux/shell/commands/unzip(65): insert_webrequest() #3 {main} thrown in /home/httpd/vhosts/renenyffenegger.ch/php/web-request-database.php on line 78