{"id":976,"date":"2022-02-11T15:24:30","date_gmt":"2022-02-11T15:24:30","guid":{"rendered":"https:\/\/blog.hostinger.io\/support\/2022\/02\/11\/5973347-how-to-create-archives-with-ssh-at-hostinger\/"},"modified":"2026-03-16T12:12:09","modified_gmt":"2026-03-16T12:12:09","slug":"5973347-how-to-create-archives-with-ssh-at-hostinger","status":"publish","type":"post","link":"https:\/\/www.hostinger.com\/support\/5973347-how-to-create-archives-with-ssh-at-hostinger\/","title":{"rendered":"How to Create Archives With SSH at Hostinger?"},"content":{"rendered":"<p class=\"no-margin\">Creating archives is possible using <b><a href=\"\/support\/5972776-how-to-create-an-archive-in-file-manager\" target=\"_blank\" class=\"intercom-content-link\">Hostinger File Manager<\/a><\/b>. If you would like to make an archive with SSH, all you need to do is: <\/p><p class=\"no-margin\">\n<\/p><h2 id=\"h_78c72a66dd\">Step 1 &ndash; Connection<\/h2><p class=\"no-margin\">First, <b><a href=\"\/support\/1583645-do-i-get-ssh-access-how-to-enable-ssh-access\" target=\"_blank\" class=\"intercom-content-link\">enable SSH access<\/a><\/b> and <b><a href=\"\/support\/1583245-how-can-i-connect-to-my-account-via-ssh\" target=\"_blank\" class=\"intercom-content-link\">connect to your account using SSH<\/a><\/b>. Open the directory, where the files and folders, which you want to compress, are located. For that: <\/p><ol>\n<li>\n<p class=\"no-margin\"><b><a href=\"\/support\/5973000-how-to-open-the-website-s-root-directory-via-ssh\" target=\"_blank\" class=\"intercom-content-link\">Open your website&rsquo;s root directory<\/a><\/b><\/p>\n<\/li>\n<li>\n<p class=\"no-margin\">Run <code>ls<\/code> command. If you see the needed files and folders, then you can go to Step 2 <\/p>\n<\/li>\n<li>\n<p class=\"no-margin\">If the needed content is in a subdirectory, reach it by running: <\/p>\n<\/li>\n<\/ol><pre><code>cd path\/to\/files<\/code><\/pre><p class=\"no-margin\">where &ldquo;path\/to\/files&rdquo; 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 &ldquo;cd new\/version1&rdquo;. <\/p><p class=\"no-margin\">\n<\/p><h2 id=\"h_5be79078c3\">Step 2 &ndash; Creating an archive <\/h2><p class=\"no-margin\">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: <\/p><p class=\"no-margin\">\n<\/p><h3 id=\"h_5c1d7ecfe9\">Archive of separate files <\/h3><p class=\"no-margin\"><b>ZIP<\/b>: <code>zip archive-name.zip filename1.php filename2.php filename3.php<\/code><br><b>TAR<\/b>: <code>tar -cvf archive.tar filename1.php filename2.php filename3.php<\/code><br><b>TAR.GZ<\/b>: <code>tar -zcf NewArchive.tar.gz filename1.php filename2.php filename3.php<\/code><\/p><p class=\"no-margin\">\n<\/p><p class=\"no-margin\">Where instead of &ldquo;archive&rdquo; write the name of your future archive, and after that &ndash; files which you would like to add to the archive. <\/p><p class=\"no-margin\">\n<\/p><h3 id=\"h_7a61d5060d\">Archive of the whole directory<\/h3><p class=\"no-margin\"><b>ZIP<\/b>: <code>zip -r archive.zip DirectoryName<\/code> <br><b>TAR<\/b>: <code>tar -cvf archive.tar DirectoryName<\/code> <br><b>TAR.GZ<\/b>: <code>tar -zcf archive.tar.gz DirectoryName <\/code> <\/p><p class=\"no-margin\">\n<\/p><div class=\"intercom-container intercom-align-center\"><img decoding=\"async\" src=\"\/support\/wp-content\/uploads\/sites\/55\/2022\/02\/f05a3dbc-e2cc-4be2-b1a4-c9579b3760c6.jpg\"><\/div><p class=\"no-margin\">Creating an archive takes some time until it&rsquo;s finished, you will see this from the new line: <\/p><pre><code>-bash-4.2$<\/code><\/pre><p class=\"no-margin\">It means, that the process is completed successfully &#128522; <\/p><p class=\"no-margin\">\n<\/p><p class=\"no-margin\"><b>NOTES<\/b>: <\/p><ul>\n<li>\n<p class=\"no-margin\"><b><a href=\"\/support\/5972776-how-to-create-an-archive-in-file-manager\" target=\"_blank\" class=\"intercom-content-link\">How to create an archive in File Manager?<\/a><\/b><\/p>\n<\/li>\n<li>\n<p class=\"no-margin\"><b><a href=\"\/support\/5966088-how-to-extract-archives-with-ssh\" target=\"_blank\" class=\"intercom-content-link\">How to extract archives with SSH?<\/a><\/b><\/p>\n<\/li>\n<\/ul>\n","protected":false},"excerpt":{"rendered":"<p>Compressing files using SSH<\/p>\n","protected":false},"author":581,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"include_on_kodee":true,"footnotes":""},"categories":[239],"tags":[],"class_list":["post-976","post","type-post","status-publish","format-standard","hentry","category-archives-management"],"hreflangs":[{"locale":"en-US","link":"https:\/\/www.hostinger.com\/support\/5973347-how-to-create-archives-with-ssh-at-hostinger\/","default":1},{"locale":"fr-FR","link":"https:\/\/www.hostinger.com\/fr\/support\/5973347-comment-creer-des-archives-avec-ssh-chez-hostinger\/","default":0},{"locale":"id-ID","link":"https:\/\/www.hostinger.com\/id\/support\/5973347-bagaimana-cara-membuat-arsip-dengan-ssh-di-hostinger\/","default":0},{"locale":"pt-PT","link":"https:\/\/www.hostinger.com\/br\/support\/5973347-como-criar-arquivos-compactados-com-o-ssh-no-hostinger\/","default":0},{"locale":"uk-UA","link":"https:\/\/www.hostinger.com\/ua\/support\/5973347------ssh--hostinger\/","default":0}],"include_on_kodee":true,"_links":{"self":[{"href":"https:\/\/www.hostinger.com\/support\/wp-json\/wp\/v2\/posts\/976","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.hostinger.com\/support\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.hostinger.com\/support\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.hostinger.com\/support\/wp-json\/wp\/v2\/users\/581"}],"replies":[{"embeddable":true,"href":"https:\/\/www.hostinger.com\/support\/wp-json\/wp\/v2\/comments?post=976"}],"version-history":[{"count":1,"href":"https:\/\/www.hostinger.com\/support\/wp-json\/wp\/v2\/posts\/976\/revisions"}],"predecessor-version":[{"id":3960,"href":"https:\/\/www.hostinger.com\/support\/wp-json\/wp\/v2\/posts\/976\/revisions\/3960"}],"wp:attachment":[{"href":"https:\/\/www.hostinger.com\/support\/wp-json\/wp\/v2\/media?parent=976"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.hostinger.com\/support\/wp-json\/wp\/v2\/categories?post=976"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.hostinger.com\/support\/wp-json\/wp\/v2\/tags?post=976"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}