How do I use ‘Tar’ and ‘Zip’ to compress files?
Print Email
Email this article
Close
Email this article
CloseYou are here: Home > Website Support > File Compression
Tar and zip commands are often used to compress a website’s content to a single smaller file to use less disk space and to expedite the download process of a large number of files. ‘Tar’ is the most common form for Unix and ‘zip’ is the most common form for Windows. However, ‘zip’ and ‘tar’ have both been ported to all computer platforms.
The following file compression methods are available with Hetzner:
1. konsoleH ‘File Manager’ tool (Zip):
- Browse to konsoleH (http://myaccount.hetzner.co.za)
- Login with your Client number and Management password
- Select or search for a domain name in the ‘Hosting Service’ tab
- Select Manage Services from the left-hand menu
- Select ‘File Manager’
- Select the file or folder which should be compressed
- Select ‘Zip File’ from the right navigation bar
Your public_html directory (all web content) can be compressed (zipped):
- Browse to konsoleH (http://myaccount.hetzner.co.za)
- Login with your Client number and Management password
- Select or search for a domain name in the ‘Hosting Service’ tab
- Select Manage Services from the left-hand menu
- Select ‘File Manager’
- Select ‘Go to Home Folder’
- Click ‘Expanded View’
- Select the ‘public_html’ folder
- Select ‘Zip File’ from the right navigation bar
2. Telnet or SSH (Tar and Zip)
To compress content within the public_html directory from a command line (Telnet or SSH) : (where [ ] indicates a filename of the user’s choice)
Tar Compress individual files:
- SSH / Telnet to the web server
- Change to the public_html directory
- run: tar -zcvf [tar_file_name.tar.gz] (file1) (file2) etc.[a-zA-Z0-9]*
- Eg. tar -zcvf testcontent.tar.gz index.html info.php
Tar Compress all public_html content (all web content):
- SSH / Telnet to the web server
- Change to the public_html directory
- tar -zcvf [tar_file_name.tar.gz] * .[a-zA-Z0-9]*
ZIP Compress individual files:
- SSH / Telnet to the web server
- Change to the public_html directory
- run: zip -rqv [zip_filename.zip] (file1) (file2) etc. .[a-zA-Z0-9]*
- Eg. zip -rqv testcontent.zip index.html info.php
ZIP Compress all public_html content (all webcontent):
- SSH / Telnet to the web server
- Change to the public_html directory
- run: zip -rqv [zip_filename.zip] * .[a-zA-Z0-9]*
Extracting files from a zip or tar involves a similar process.
Was this information helpful?
Yes NoThank you for your feedback
We are delighted to find that our article resolved your query.
Thank you for your feedback
We will resolve your query as soon as possible.
Please take a few moments to comment on your unresolved query. Simply tell us what your problem is. We guarantee that we'll get back to you within two hours (during office hours) in response to your query.
