SSH lets you create an archive of files or a directory on your hosting account without downloading each item separately. This guide shows ZIP, TAR and compressed TAR examples for a Linux shell.

Before you start

You need SSH access, permission to read the source files and enough space for the archive. The required zip or tar tool must be installed.

Choose a private archive destination outside the source directory and the public website folders. Archives may contain passwords or personal data.

Select the source

Connect through SSH, then change to the directory containing the items:

cd /home/example/public_html
ls -la

Replace the path with your website’s actual location. Quote paths or filenames containing spaces.

Archive selected files

Choose one command for the required format, replacing the filenames and private destination path:

zip /home/example/files-backup.zip index.php config.php
tar -cf /home/example/files-backup.tar index.php config.php
tar -czf /home/example/files-backup.tar.gz index.php config.php

Archive a directory

Run the chosen command from the directory containing site-folder:

zip -r /home/example/site-backup.zip site-folder
tar -cf /home/example/site-backup.tar site-folder
tar -czf /home/example/site-backup.tar.gz site-folder

Use a new archive filename rather than overwriting an existing backup. ZIP can update an existing archive, which may retain older entries.

Check the archive

Wait for the command to finish and check for errors. List the archive’s contents using the matching command:

unzip -l /home/example/site-backup.zip
tar -tf /home/example/site-backup.tar
tar -tzf /home/example/site-backup.tar.gz

Download the archive to private storage and test extraction into a separate location. These examples archive files, not a consistent backup of a running database.