Skip to main content
How to create archives with SSH?

Compressing files using SSH

Updated over a week ago

Creating archives is possible using Hostinger File Manager. If you would like to make an archive with SSH, all you need to do is:

Step 1 - Connection

First, enable SSH access and connect to your account using SSH. Open the directory, where the files and folders, which you want to compress, are located. For that:

  1. Run ls command. If you see the needed files and folders, then you can go to Step 2

  2. If the needed content is in a subdirectory, reach it by running:

cd path/to/files

where "path/to/files" is changed by an actual path to your files. For example, if your files are located in public_html/new/version1, then the command should be "cd new/version1".

Step 2 - Creating an archive

You only need 1 command to create an archive. The command is different based on what you would like to compress and to which archive format you want to save it:

Archive of separate files

ZIP: zip archive-name.zip filename1.php filename2.php filename3.php
TAR: tar -cvf archive.tar filename1.php filename2.php filename3.php
TAR.GZ: tar -zcf NewArchive.tar.gz filename1.php filename2.php filename3.php

Where instead of "archive" write the name of your future archive, and after that - files which you would like to add to the archive.

Archive of the whole directory

ZIP: zip -r archive.zip DirectoryName
TAR: tar -cvf archive.tar DirectoryName
TAR.GZ: tar -zcf archive.tar.gz DirectoryName

Creating an archive takes some time until it's finished, you will see this from the new line:

-bash-4.2$


It means, that the process is completed successfully 😊

NOTES:

Did this answer your question?