{"id":1125,"date":"2018-08-22T10:37:34","date_gmt":"2018-08-22T05:07:34","guid":{"rendered":"https:\/\/www.coimbatorewebhosting.com\/blog\/?p=1125"},"modified":"2019-04-09T16:21:28","modified_gmt":"2019-04-09T10:51:28","slug":"delete-files-and-folders-via-ssh","status":"publish","type":"post","link":"https:\/\/coimbatorewebhosting.com\/blog\/delete-files-and-folders-via-ssh\/","title":{"rendered":"Steps to delete Files and Folders via SSH"},"content":{"rendered":"<div id=\"ez-toc-container\" class=\"ez-toc-v2_0_82_2 counter-hierarchy ez-toc-counter ez-toc-grey ez-toc-container-direction\">\n<div class=\"ez-toc-title-container\">\n<p class=\"ez-toc-title\" style=\"cursor:inherit\">Table of Contents<\/p>\n<span class=\"ez-toc-title-toggle\"><a href=\"#\" class=\"ez-toc-pull-right ez-toc-btn ez-toc-btn-xs ez-toc-btn-default ez-toc-toggle\" aria-label=\"Toggle Table of Content\"><span class=\"ez-toc-js-icon-con\"><span class=\"\"><span class=\"eztoc-hide\" style=\"display:none;\">Toggle<\/span><span class=\"ez-toc-icon-toggle-span\"><svg style=\"fill: #999;color:#999\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" class=\"list-377408\" width=\"20px\" height=\"20px\" viewBox=\"0 0 24 24\" fill=\"none\"><path d=\"M6 6H4v2h2V6zm14 0H8v2h12V6zM4 11h2v2H4v-2zm16 0H8v2h12v-2zM4 16h2v2H4v-2zm16 0H8v2h12v-2z\" fill=\"currentColor\"><\/path><\/svg><svg style=\"fill: #999;color:#999\" class=\"arrow-unsorted-368013\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"10px\" height=\"10px\" viewBox=\"0 0 24 24\" version=\"1.2\" baseProfile=\"tiny\"><path d=\"M18.2 9.3l-6.2-6.3-6.2 6.3c-.2.2-.3.4-.3.7s.1.5.3.7c.2.2.4.3.7.3h11c.3 0 .5-.1.7-.3.2-.2.3-.5.3-.7s-.1-.5-.3-.7zM5.8 14.7l6.2 6.3 6.2-6.3c.2-.2.3-.5.3-.7s-.1-.5-.3-.7c-.2-.2-.4-.3-.7-.3h-11c-.3 0-.5.1-.7.3-.2.2-.3.5-.3.7s.1.5.3.7z\"\/><\/svg><\/span><\/span><\/span><\/a><\/span><\/div>\n<nav><ul class='ez-toc-list ez-toc-list-level-1 ' ><li class='ez-toc-page-1 ez-toc-heading-level-1'><a class=\"ez-toc-link ez-toc-heading-1\" href=\"https:\/\/coimbatorewebhosting.com\/blog\/delete-files-and-folders-via-ssh\/#Delete_Files_and_Folders_via_SSH\" >Delete Files and Folders via SSH<\/a><ul class='ez-toc-list-level-2' ><li class='ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-2\" href=\"https:\/\/coimbatorewebhosting.com\/blog\/delete-files-and-folders-via-ssh\/#List_files_in_SSH\" >List files in SSH<\/a><\/li><\/ul><\/li><\/ul><\/nav><\/div>\n<h1><span class=\"ez-toc-section\" id=\"Delete_Files_and_Folders_via_SSH\"><\/span><span style=\"text-decoration: underline;\">Delete Files and Folders via SSH<\/span><span class=\"ez-toc-section-end\"><\/span><\/h1>\n<p>Here i give some common guide lines how to remove files and folders from your account via SSH.<\/p>\n<p>Sometimes you would need to remove a file or a folder from the system. To do so using <a href=\"https:\/\/www.ssh.com\/ssh\/download\/\" rel=\"nofollow noopener\" target=\"_blank\">SSH<\/a>, you would need to execute the appropriate command \u2013\u00a0<strong>rm<\/strong>.<\/p>\n<p>The command in its simplest form looks like:<\/p>\n<pre>rm myfile.txt myfile1.txt myfile2.txt<\/pre>\n<h2><span class=\"ez-toc-section\" id=\"List_files_in_SSH\"><\/span>List files in SSH<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p>However listing all files\/folders that need to be deleted can be quite time consuming. Fortunately,\u00a0<strong>rm<\/strong>\u00a0accepts several arguments which can ease your task. In the above example, you could type:<\/p>\n<pre>rm myfile*.txt<\/pre>\n<p>This will match all files starting with \u2018myFile\u2019 and ending in \u2018.txt\u2019 and delete them.<\/p>\n<p>To delete a whole folder and its content recursively, you can use:<\/p>\n<pre>rm -rf foldername\/<\/pre>\n<p>To delete all files\/folders in the current directory, without deleting the directory itself, you would need to use:<\/p>\n<pre>rm -rf*<\/pre>\n<p>If in case if you need to search the files or folders via SSH <a href=\"https:\/\/www.coimbatorewebhosting.com\/blog\/search-for-files-and-folders\/\">click here.<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Delete Files and Folders via SSH Here i give some common guide lines how to remove files and folders from your account via SSH. Sometimes you would need to remove a file or a folder from the system. To do so using SSH, you would need to execute the appropriate [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":1140,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":true,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2}},"categories":[153],"tags":[116,20],"class_list":["post-1125","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-centos-7-rhel-7","tag-rm","tag-ssh"],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"https:\/\/coimbatorewebhosting.com\/blog\/wp-content\/uploads\/2018\/08\/SSH1.png","jetpack_sharing_enabled":true,"jetpack_shortlink":"https:\/\/wp.me\/pa2YU7-i9","_links":{"self":[{"href":"https:\/\/coimbatorewebhosting.com\/blog\/wp-json\/wp\/v2\/posts\/1125","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/coimbatorewebhosting.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/coimbatorewebhosting.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/coimbatorewebhosting.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/coimbatorewebhosting.com\/blog\/wp-json\/wp\/v2\/comments?post=1125"}],"version-history":[{"count":0,"href":"https:\/\/coimbatorewebhosting.com\/blog\/wp-json\/wp\/v2\/posts\/1125\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/coimbatorewebhosting.com\/blog\/wp-json\/wp\/v2\/media\/1140"}],"wp:attachment":[{"href":"https:\/\/coimbatorewebhosting.com\/blog\/wp-json\/wp\/v2\/media?parent=1125"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/coimbatorewebhosting.com\/blog\/wp-json\/wp\/v2\/categories?post=1125"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/coimbatorewebhosting.com\/blog\/wp-json\/wp\/v2\/tags?post=1125"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}