{"id":1139,"date":"2020-12-16T07:31:47","date_gmt":"2020-12-16T07:31:47","guid":{"rendered":"https:\/\/blog.hostinger.io\/support\/2020\/12\/16\/4725430-how-to-delete-files-or-folders-using-ssh-at-hostinger\/"},"modified":"2026-03-16T12:12:12","modified_gmt":"2026-03-16T12:12:12","slug":"4725430-how-to-delete-files-or-folders-using-ssh-at-hostinger","status":"publish","type":"post","link":"https:\/\/www.hostinger.com\/support\/4725430-how-to-delete-files-or-folders-using-ssh-at-hostinger\/","title":{"rendered":"How to Delete Files or Folders Using SSH at Hostinger"},"content":{"rendered":"<p class=\"no-margin\">Deleting files and folders is possible using <b>Hostinger File Manager<\/b>:<\/p><p class=\"no-margin\">\n<\/p><div class=\"intercom-container intercom-align-center\"><img decoding=\"async\" src=\"https:\/\/blog.hostinger.io\/pt\/support\/wp-content\/uploads\/sites\/59\/2022\/09\/e02048db-f93d-4e35-b69d-684559964923.jpg\"><\/div><p class=\"no-margin\">If you would like to delete files and folders with SSH, all you need to do is:<\/p><p class=\"no-margin\">\n<\/p><h2 id=\"h_41f07cf3b2\">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 delete, 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_59980214dc\">Step 2 &ndash; Deleting<\/h2><p class=\"no-margin\">You only need 1 command to delete files or folders, just chose the option the most suitable for you:<\/p><ul>\n<li>\n<p class=\"no-margin\">To delete a <b>file<\/b> or <b>files<\/b>:<\/p>\n<\/li>\n<\/ul><pre><code>rm filename.php<br><br>rm filename1.php filename2.php filename3.php<\/code><\/pre><ul>\n<li>\n<p class=\"no-margin\">To delete a <b>whole folder <\/b>and its contents:<\/p>\n<\/li>\n<\/ul><pre><code>rm -r foldername\/<\/code><\/pre><ul>\n<li>\n<p class=\"no-margin\">To delete <b>all files in a directory <\/b>including files and folders inside of it:<\/p>\n<\/li>\n<\/ul><pre><code>rm -r *<\/code><\/pre><p class=\"no-margin\">That&rsquo;s it! Now you know how to delete files and folders using <b>SSH<\/b> &#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\/4725353-how-to-copy-files-or-folders-using-ssh\" target=\"_blank\" class=\"intercom-content-link\">How to copy files or folders using SSH?<\/a><\/b><\/p>\n<\/li>\n<li>\n<p class=\"no-margin\"><b><a href=\"\/support\/5973347-how-to-create-archives-with-ssh\" target=\"_blank\" class=\"intercom-content-link\">How to create archives with SSH?<\/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>Deleting files and folders 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":[235],"tags":[],"class_list":["post-1139","post","type-post","status-publish","format-standard","hentry","category-ssh-connection-and-ssh-keys"],"hreflangs":[{"locale":"en-US","link":"https:\/\/www.hostinger.com\/support\/4725430-how-to-delete-files-or-folders-using-ssh-at-hostinger\/","default":1},{"locale":"es-ES","link":"https:\/\/www.hostinger.com\/es\/support\/4725430-como-eliminar-archivos-o-carpetas-usando-ssh-en-hostinger\/","default":0},{"locale":"fr-FR","link":"https:\/\/www.hostinger.com\/fr\/support\/4725430-comment-supprimer-des-fichiers-ou-des-dossiers-en-utilisant-ssh-chez-hostinger\/","default":0},{"locale":"id-ID","link":"https:\/\/www.hostinger.com\/id\/support\/4725430-bagaimana-cara-menghapus-file-atau-folder-dengan-ssh-di-hostinger\/","default":0},{"locale":"pt-PT","link":"https:\/\/www.hostinger.com\/br\/support\/4725430-como-excluir-arquivos-ou-pastas-usando-ssh-no-hostinger\/","default":0},{"locale":"uk-UA","link":"https:\/\/www.hostinger.com\/ua\/support\/4725430-------\/","default":0}],"include_on_kodee":true,"_links":{"self":[{"href":"https:\/\/www.hostinger.com\/support\/wp-json\/wp\/v2\/posts\/1139","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=1139"}],"version-history":[{"count":1,"href":"https:\/\/www.hostinger.com\/support\/wp-json\/wp\/v2\/posts\/1139\/revisions"}],"predecessor-version":[{"id":4512,"href":"https:\/\/www.hostinger.com\/support\/wp-json\/wp\/v2\/posts\/1139\/revisions\/4512"}],"wp:attachment":[{"href":"https:\/\/www.hostinger.com\/support\/wp-json\/wp\/v2\/media?parent=1139"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.hostinger.com\/support\/wp-json\/wp\/v2\/categories?post=1139"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.hostinger.com\/support\/wp-json\/wp\/v2\/tags?post=1139"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}