Compress folders in SSH
When you want to compress large folders or if you don't have access to a file manager, you'll need to use a Secure Shell (SSH) connection to create compressed files.
Required: You'll need an SSH app to complete these steps. We suggest PuTTY for Windows, or Terminal for macOS.
- Connect to your hosting account with SSH.
- Use the command ls to list files and folders, and cd and ../ to move through directories until you are in the directory above the one you want to compress. For example, if you want to compress the wp-content folder located in the public_html folder, you should be in the public_html folder.
- Use one of the following commands depending on the type of compression you want:
- To create a .tar.gz file enter:
tar -czvf filename.tar.gz /foldername
- To create a .zip file enter:
zip –r filename.zip /foldername
- To create a .tar.gz file enter:
- Select Enter on your keyboard.
Your folder is now compressed, and you can download the file to your local computer or transfer it to another location.