To compress content within the public_html directory via SSH: (where [ ] indicates a filename of the user’s choice)
Tar Compress individual files:
-
SSH 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 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 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 web content):
-
SSH 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.