Skip to main content
0 reactions

How to Unzip a File in the Terminal

Card titled unzip in the Terminal, labelled shell basics, with four ticked lines: unzip photos.zip, creating photos, extracting the files, and ls photos.

unzip takes the files out of a .zip file and puts them in the folder you’re in, keeping the folders they were stored in.

Every command and output on this page is real, run in Terminal with zsh 5.9 and UnZip 6.00 on macOS 26.

Syntax

SyntaxBash
unzip file.zip
  • unzip: the command that unpacks a zip file.
  • file.zip: the zip file to unpack.

See UnZip (opens in a new tab) on the Info-ZIP site, the makers of unzip.

The Example

A zip file named photos.zip that holds a folder named photos with three files.

Step 1: Unzip the File

TerminalBash
unzip photos.zip
OutputPlain text
Archive:  photos.zip
   creating: photos
 extracting: photos/notes.txt
 extracting: photos/trip-2026.jpg
 extracting: photos/trip-2025.jpg

creating is a folder it made, and each extracting is a file it took out.

Step 2: Look at the Files

TerminalBash
ls photos
OutputPlain text
notes.txt       trip-2025.jpg   trip-2026.jpg

Common Mistakes

MistakeWhat happensDo this instead
Unzipping again where the files already areunzip asks replace photos/notes.txt? [y]es, [n]o, [A]ll, [N]one, [r]ename:Type N to keep the files you have, or A to replace them all

FAQ

Where do the files go?

Into the folder you’re in, with the same folders they had inside the zip.

Conclusion

Type unzip and the file’s name in the folder where the files should go.

Additional Resources

macOS is a trademark of Apple Inc.

0 comments