How to unzip files

Grzegorz Bardski
1 min readJun 5, 2021

When uploading the app on the cloud

unzip -l to preview the content of the package
unzip -Z to view detailed contents of a zipped file
unzip -d to unzip to a specific directory
for example
unzip release_v3.0.zip -d /home/user/Documents

unzip -o to overwrite the existing files

When you unzip without the -o option you will be prompted what to do with the files that have the same name, replace, ignore, all, none, etc. -o option presumes that you overwrite all the files for which you get this question.

unzip -u to update files and create new ones if necessary.

This option means that you overwrite only the files with newer timestamp. Also, when the file doesn’t exist it will be created.

I love this option and use it a lot. It’s particularly useful when updating a web app. After making some changes locally I run script that zips all the files necessary for the app to run. Then I upload the archive on the server and run unzip -u. The cool thing is that it substitutes only the files I changed since my last update.

So, the final command would be:
unzip -u release.zip -d /home/user/release/

unzip -f to freshen existing files but without creating new ones.

unzip -x to exclude files from extracting.

For example unzip release_v3.1.zip -x config.json.

--

--