Solved: Tar.Gz compress Magento folder over SSH

When you need to to pack and download your whole Magento installation and there are no good tools for this available in your webhost’s admin panel, maybe you can use SSH to backup your Magento installation.


1. Create a SSH connection

In order to create a SSH connection – you need a SSH client, like Bitvise SSH, and a SSH connection allowed from your webhost. See your webhost’s support pages whether SSH is allowed or not.


2. Use the SSH client to connect

Then when you are already in the console, using the commands dir and cd move to the directory one up of your public_html or www root.


3. Compress the folder

When one up from Magento installation directory, run this command to tar.gz compress your whole Magento folder to downloadable tar.gz file.

tar -zcf archive-name.tar.gz foldername/


Replace archive-name with your desired tar.gz filename, remember to not change the filename extension tar.gz. 

Replace foldername/ with your folder name (www, public_html) where you have your Magento installed. 


That’s it. Hit enter and it will compress your whole Magento files into one zipped tar.gz container. This will take minutes and no progress will be displayed so be patient. Once done, the SSH console just starts a new command line. 

Practice on a non-production environment first!


Post Author: Tom Pai