Compress Folder in Terminal


We need to copy a large amount of files but we don’t want to type in every file name and want to save space. So basically we want to compress a folder (or files) in terminal.

Compress folder in terminal

We have many alternatives on this topic, to keep it simple I’ll be using the zip command.

zip -r folder

A real example would look like

zip -r uploads/

This will produce a neat file with all the contents from the folder we want to compress.

Extract files in terminal

We’ve learned how to compress folder in terminal and now we need to learn how to extract files in terminal so that we can actually use our files.


This command will extract the contents of the archive exactly as they were before they were zipped.


You can copy files using SSH terminal and move it between your servers using this way. Compressing saves space and makes everything easier.