{"id":9012,"date":"2026-05-30T14:21:27","date_gmt":"2026-05-30T12:21:27","guid":{"rendered":"https:\/\/mybox.com\/help\/?post_type=manual_kb&#038;p=9012"},"modified":"2026-05-30T14:21:28","modified_gmt":"2026-05-30T12:21:28","slug":"comenzi-ssh-rm","status":"publish","type":"manual_kb","link":"https:\/\/mybox.com\/help\/ro\/knowledgebase\/ssh-commands-rm\/","title":{"rendered":"Comenzi SSH \u2013 rm"},"content":{"rendered":"<div class=\"translation-block translation-block-merged\">\n<p class=\"wp-block-paragraph\">In server administration, backend web development, and cloud systems engineering, purging obsolete files and clearing out old development environments is a standard maintenance task. The <strong><code>rm<\/code><\/strong> command stands for <strong>Remove<\/strong>. It is a core POSIX-standard terminal utility used to permanently delete files and directories from your server&#8217;s filesystem.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Unlike desktop graphical user interfaces, the Linux command line <strong>does not have a recycle bin or trash folder<\/strong>. Once an asset is deleted using the <code>rm<\/code> command, its file system pointers are unlinked immediately, making recovery near-impossible without restoring data from an external backup.<\/p>\n\n\n\n<div id=\"ez-toc-container\" class=\"ez-toc-v2_0_86 ez-toc-wrap-left counter-hierarchy ez-toc-counter ez-toc-custom 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\"><\/span><\/div>\n<nav><ul class='ez-toc-list ez-toc-list-level-1' ><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-1\" href=\"https:\/\/mybox.com\/help\/ro\/knowledgebase\/ssh-commands-rm\/#Direct_Deletion_Operations_and_Primary_Command_Flags\" >Direct Deletion Operations and Primary Command Flags<\/a><ul class='ez-toc-list-level-3' ><li class='ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-2\" href=\"https:\/\/mybox.com\/help\/ro\/knowledgebase\/ssh-commands-rm\/#1_Recursive_Folder_Deletion_rm_-r_or_rm_-R\" >1. Recursive Folder Deletion (rm -r or rm -R)<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-3\" href=\"https:\/\/mybox.com\/help\/ro\/knowledgebase\/ssh-commands-rm\/#2_Forcing_Deletions_and_Bypassing_Prompts_rm_-f\" >2. Forcing Deletions and Bypassing Prompts (rm -f)<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-4\" href=\"https:\/\/mybox.com\/help\/ro\/knowledgebase\/ssh-commands-rm\/#The_Destructive_Risk_Warning\" >The Destructive Risk Warning<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-5\" href=\"https:\/\/mybox.com\/help\/ro\/knowledgebase\/ssh-commands-rm\/#3_Enforcing_Safety_with_Interactive_Mode_rm_-i\" >3. Enforcing Safety with Interactive Mode (rm -i)<\/a><\/li><\/ul><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-6\" href=\"https:\/\/mybox.com\/help\/ro\/knowledgebase\/ssh-commands-rm\/#Working_with_Absolute_Brand_Directory_Paths\" >Working with Absolute Brand Directory Paths<\/a><ul class='ez-toc-list-level-3' ><li class='ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-7\" href=\"https:\/\/mybox.com\/help\/ro\/knowledgebase\/ssh-commands-rm\/#Removing_an_Environment_Backup_File\" >Removing an Environment Backup File<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-8\" href=\"https:\/\/mybox.com\/help\/ro\/knowledgebase\/ssh-commands-rm\/#Deleting_a_Staging_Branch_via_Absolute_Pathing\" >Deleting a Staging Branch via Absolute Pathing<\/a><\/li><\/ul><\/li><\/ul><\/nav><\/div>\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Direct_Deletion_Operations_and_Primary_Command_Flags\"><\/span>Direct Deletion Operations and Primary Command Flags<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<\/div>\n\n<div id=\"mybox-2944568492\" class=\"mybox-content mybox-entity-placement\"><div class=\"early-access-banner-inpost\">\r\n  <div class=\"banner-left-inpost\">\r\n    <div class=\"icon-box-inpost\">\r\n      <img decoding=\"async\" src=\"https:\/\/mybox.com\/help\/wp-content\/uploads\/2026\/02\/square-info-icon.svg\" alt=\"Info\">\r\n    <\/div>\r\n    <div class=\"text-box-inpost\">\r\n      <span class=\"label-inpost\"><span class=\"translation-block translation-block-banner-text\">Acces timpuriu<\/span><\/span>\r\n      <h4><span class=\"translation-block translation-block-banner-text\">Mai ave\u021bi nevoie de ajutor?<\/span><\/h4>\r\n      <p><span class=\"translation-block translation-block-banner-text\">Contacta\u021bi echipa noastr\u0103 de servicii pentru clien\u021bi.<\/span><\/p>\r\n    <\/div>\r\n  <\/div>\r\n\r\n  <div class=\"banner-right-inpost\">\r\n    <a href=\"https:\/\/panel.mybox.com\/helpdesk2\/v\/list\/\" class=\"banner-button-inpost\"><span class=\"translation-block translation-block-banner-text\">Trimite mesaj<\/span><\/a>\r\n  <\/div>\r\n<\/div><\/div>\n\n<div class=\"translation-block translation-block-merged\"><p class=\"wp-block-paragraph\">The basic syntax for removing a single file requires passing the command followed by the filename: <code>rm target_file.txt<\/code>. To handle read-only locks, delete entire folder trees, or enable safety confirmations, you will regularly append these core operational flags:<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"1_Recursive_Folder_Deletion_rm_-r_or_rm_-R\"><\/span>1. Recursive Folder Deletion (<code>rm -r<\/code> or <code>rm -R<\/code>)<span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">By default, running <code>rm<\/code> on a directory results in an error because the base command is restricted to individual files. To delete a directory along with all of its nested subfolders, configurations, and assets, you must use the <code>-r<\/code> (recursive) flag. This serves as a powerful alternative to <code>rmdir<\/code>, which only allows you to delete completely empty folders.<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>The Action:<\/strong> Run the recursive flag followed by your target folder path:Bash<code>rm -r old_staging_site\/<\/code><\/li>\n\n\n\n<li><strong>Operational Benefit:<\/strong> This allows you to wipe out an entire website archive or module structure in a single execution step.<\/li>\n<\/ul>\n\n\n\n<h3 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"2_Forcing_Deletions_and_Bypassing_Prompts_rm_-f\"><\/span>2. Forcing Deletions and Bypassing Prompts (<code>rm -f<\/code>)<span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">The <code>-f<\/code> (force) flag overrides default environment rules, ignores non-existent files, and suppresses confirmation prompts. It tells the server to delete write-protected or read-only files immediately without asking for user permission.<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>The Action:<\/strong> Combine the force flag with the recursive flag for high-level directory purges:Bash<code>rm -rf temporary_cache_directory\/<\/code><\/li>\n<\/ul>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\">\n<h3 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"The_Destructive_Risk_Warning\"><\/span>The Destructive Risk Warning<span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Combining the recursive and force flags (<code>rm -rf<\/code>) makes the command highly destructive. Executing an unverified command like <code>rm -rf \/<\/code> or running it inside the wrong folder can wipe out your entire filesystem. Always verify your current location first by running a <code>pwd<\/code> check before executing this loop.<\/p>\n<\/blockquote>\n\n\n\n<h3 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"3_Enforcing_Safety_with_Interactive_Mode_rm_-i\"><\/span>3. Enforcing Safety with Interactive Mode (<code>rm -i<\/code>)<span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">To prevent accidental data loss, the <code>-i<\/code> (interactive) flag forces the server to pause and ask for confirmation before deleting each individual file.<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>The Action:<\/strong> Add the interactive safety filter to your deletion string:Bash<code>rm -i production_config.json<\/code><\/li>\n\n\n\n<li><strong>The Prompt Returned:<\/strong> The terminal will stop and print a question: <code>remove production_config.json? (y\/n)<\/code>. You must type <code>y<\/code> and press Enter to approve the deletion, or <code>n<\/code> to safely cancel it.<\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Working_with_Absolute_Brand_Directory_Paths\"><\/span>Working with Absolute Brand Directory Paths<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">You can target and purge files anywhere in your server account by leveraging absolute paths. When managing cleanups inside your brand infrastructure, map your routes explicitly from your home directory root:<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Removing_an_Environment_Backup_File\"><\/span>Removing an Environment Backup File<span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">To delete an old environment backup asset from your live root folder, execute a direct relative path command:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>rm public_html\/.env.bak\n<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Deleting_a_Staging_Branch_via_Absolute_Pathing\"><\/span>Deleting a Staging Branch via Absolute Pathing<span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">To remove an obsolete development branch for an independent domain name within your brand environment, use explicit absolute targeting:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>rm -rf \/home\/mybox\/yourlogin\/innastrona.pl\/public_html\/staging-v1\/<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\"><\/p>\n<\/div>","protected":false},"author":1,"featured_media":0,"parent":0,"menu_order":0,"template":"","format":"standard","manualknowledgebasecat":[54],"manual_kb_tag":[1180,3583,4281,6174,6175,6176,6177,6178,6179,6180],"class_list":["post-9012","manual_kb","type-manual_kb","status-publish","format-standard","hentry","manualknowledgebasecat-ssh","manual_kb_tag-server-administration","manual_kb_tag-permanent-deletion","manual_kb_tag-linux-command-line","manual_kb_tag-backend-web-development","manual_kb_tag-cloud-systems-engineering","manual_kb_tag-system-maintenance","manual_kb_tag-file-deletion","manual_kb_tag-remove-command","manual_kb_tag-terminal-utility","manual_kb_tag-recursive-deletion"],"_links":{"self":[{"href":"https:\/\/mybox.com\/help\/ro\/wp-json\/wp\/v2\/manual_kb\/9012","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/mybox.com\/help\/ro\/wp-json\/wp\/v2\/manual_kb"}],"about":[{"href":"https:\/\/mybox.com\/help\/ro\/wp-json\/wp\/v2\/types\/manual_kb"}],"author":[{"embeddable":true,"href":"https:\/\/mybox.com\/help\/ro\/wp-json\/wp\/v2\/users\/1"}],"version-history":[{"count":1,"href":"https:\/\/mybox.com\/help\/ro\/wp-json\/wp\/v2\/manual_kb\/9012\/revisions"}],"predecessor-version":[{"id":9013,"href":"https:\/\/mybox.com\/help\/ro\/wp-json\/wp\/v2\/manual_kb\/9012\/revisions\/9013"}],"wp:attachment":[{"href":"https:\/\/mybox.com\/help\/ro\/wp-json\/wp\/v2\/media?parent=9012"}],"wp:term":[{"taxonomy":"manualknowledgebasecat","embeddable":true,"href":"https:\/\/mybox.com\/help\/ro\/wp-json\/wp\/v2\/manualknowledgebasecat?post=9012"},{"taxonomy":"manual_kb_tag","embeddable":true,"href":"https:\/\/mybox.com\/help\/ro\/wp-json\/wp\/v2\/manual_kb_tag?post=9012"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}