{"id":3328,"date":"2014-06-27T14:16:29","date_gmt":"2014-06-27T14:16:29","guid":{"rendered":"https:\/\/www.inmotionhosting.com\/support\/2014\/06\/27\/rm-command\/"},"modified":"2014-06-27T14:16:29","modified_gmt":"2014-06-27T14:16:29","slug":"rm-command","status":"publish","type":"post","link":"https:\/\/www.inmotionhosting.com\/support\/server\/linux\/rm-command\/","title":{"rendered":"rm command"},"content":{"rendered":"<p>The <strong>rm<\/strong> (remove) command uses a list of arguments that specifies either the absolute or relative path of the files to remove. Use this command with care as you cannot recover a file once it has been removed. Because of this, the base <strong>rm<\/strong> command will prompt you before deleting to give you a chance to avoid any mistakes.<\/p>\n<p><strong>Command: <\/strong>rm<br \/> <strong>Synopsis: <\/strong> rm [OPTION]&#8230; FILE&#8230; <\/p>\n<div><strong>Options: <\/strong><\/div>\n<table class=\"article_table\">\n<tr>\n<th>Option<\/th>\n<th>Long option name<\/th>\n<th>Description<\/th>\n<\/tr>\n<tr>\n<td>-f<\/td>\n<td>&#8211;force<\/td>\n<td>Ignores nonexistent files. Also does not prompt the user before deleting. This option can be dangerous if misused.<\/td>\n<\/tr>\n<tr>\n<td>-i<\/td>\n<td>&#8211;interactive<\/td>\n<td>Prompts the user before any removal&gt; This is default behavior even if the option is not used.<\/td>\n<\/tr>\n<tr>\n<td>-r -R<\/td>\n<td>&#8211;recursive<\/td>\n<td>Removes all directories and their contents recursively.<\/td>\n<\/tr>\n<tr>\n<td>-v<\/td>\n<td>&#8211;verbose<\/td>\n<td>Explains what is being done by displaying it on the terminal screen.<\/td>\n<\/tr>\n<\/table>\n<h2>Examples<\/h2>\n<h3>Base rm command<\/h3>\n<p>This example shows the base command as we use it to remove a file named test.txt. <\/p>\n<pre class=\"cli\"> # <span style=\"color:red\">rm est.txt<\/span> rm: remove regular empty file `test.txt'? y <\/pre>\n<\/p>\n<h3>Forcing the rm command<\/h3>\n<p>This command is like the base command, simply removing a file. Note that adding the force option causes the computer not to prompt the user, so the removal was automatic. <\/p>\n<pre class=\"cli\"> # <span style=\"color:red\">rm -f test.txt<\/span> <\/pre>\n<\/p>\n<h3>Removing a directory<\/h3>\n<p>The format for removing a directory is similar to removing a file. You do need use the recursive option in order to make it remove the directory and all the files and other folders within it. It will, however, prompt you for each individual file and folder inside it. The example below demonstrates this process. <\/p>\n<pre class=\"cli\"> # <span style=\"color:red\">rm -r test<\/span> rm: descend into directory `test'? y rm: remove regular empty file `test\/index.php'? y rm: descend into directory `test\/images'? y rm: remove regular empty file `test\/images\/file3.png'? y rm: remove regular empty file `test\/images\/file1.png'? y rm: remove regular empty file `test\/images\/file2.png'? y rm: remove directory `test\/images'? y rm: remove directory `test'? y <\/pre>\n<\/p>\n<h3>Removing a directory without prompting<\/h3>\n<p>Removing the files and folders without prompting is much faster. Be sure you know what you are deleting when using this option combination. Below we show an example of combining the recursive and force options to removing the same <em>test<\/em> directory.No prompting will occur and the items (all subfolders and files) including the directory itself will be deleted. <\/p>\n<pre class=\"cli\"> # <span style=\"color:red\">rm -rf test<\/span> <\/pre><\/p>\n","protected":false},"excerpt":{"rendered":"<p>The rm (remove) command uses a list of arguments that specifies either the absolute or relative path of the files to remove. Use this command with care as you cannot recover a file once it has been removed. Because of this, the base rm command will prompt you before deleting to give you a chance<a class=\"moretag\" href=\"https:\/\/www.inmotionhosting.com\/support\/server\/linux\/rm-command\/\"> Read More ><\/a><\/p>\n","protected":false},"author":8,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[4308],"tags":[],"class_list":["post-3328","post","type-post","status-publish","format-standard","hentry","category-linux"],"acf":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.1.1 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>rm command | InMotion Hosting<\/title>\n<meta name=\"description\" content=\"Learn to use the Linux rm command.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.inmotionhosting.com\/support\/server\/linux\/rm-command\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"rm command | InMotion Hosting\" \/>\n<meta property=\"og:description\" content=\"Learn to use the Linux rm command.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.inmotionhosting.com\/support\/server\/linux\/rm-command\/\" \/>\n<meta property=\"og:site_name\" content=\"InMotion Hosting Support Center\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/inmotionhosting\/\" \/>\n<meta property=\"article:published_time\" content=\"2014-06-27T14:16:29+00:00\" \/>\n<meta name=\"author\" content=\"Scott Mitchell\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@InMotionHosting\" \/>\n<meta name=\"twitter:site\" content=\"@InMotionHosting\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Scott Mitchell\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"2 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/www.inmotionhosting.com\/support\/server\/linux\/rm-command\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/www.inmotionhosting.com\/support\/server\/linux\/rm-command\/\"},\"author\":{\"name\":\"Scott Mitchell\",\"@id\":\"https:\/\/www.inmotionhosting.com\/support\/#\/schema\/person\/d850efb28ef3573db7d24b0d8fa9eaed\"},\"headline\":\"rm command\",\"datePublished\":\"2014-06-27T14:16:29+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/www.inmotionhosting.com\/support\/server\/linux\/rm-command\/\"},\"wordCount\":314,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\/\/www.inmotionhosting.com\/support\/#organization\"},\"articleSection\":[\"Linux\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/www.inmotionhosting.com\/support\/server\/linux\/rm-command\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.inmotionhosting.com\/support\/server\/linux\/rm-command\/\",\"url\":\"https:\/\/www.inmotionhosting.com\/support\/server\/linux\/rm-command\/\",\"name\":\"rm command | InMotion Hosting\",\"isPartOf\":{\"@id\":\"https:\/\/www.inmotionhosting.com\/support\/#website\"},\"datePublished\":\"2014-06-27T14:16:29+00:00\",\"description\":\"Learn to use the Linux rm command.\",\"breadcrumb\":{\"@id\":\"https:\/\/www.inmotionhosting.com\/support\/server\/linux\/rm-command\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.inmotionhosting.com\/support\/server\/linux\/rm-command\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.inmotionhosting.com\/support\/server\/linux\/rm-command\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/www.inmotionhosting.com\/support\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"rm command\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.inmotionhosting.com\/support\/#website\",\"url\":\"https:\/\/www.inmotionhosting.com\/support\/\",\"name\":\"InMotion Hosting Support Center\",\"description\":\"Web Hosting Support &amp; Tutorials\",\"publisher\":{\"@id\":\"https:\/\/www.inmotionhosting.com\/support\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.inmotionhosting.com\/support\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/www.inmotionhosting.com\/support\/#organization\",\"name\":\"InMotion Hosting\",\"url\":\"https:\/\/www.inmotionhosting.com\/support\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.inmotionhosting.com\/support\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/www.inmotionhosting.com\/support\/wp-content\/uploads\/2023\/02\/inmotion-hosting-logo-yoast.jpg\",\"contentUrl\":\"https:\/\/www.inmotionhosting.com\/support\/wp-content\/uploads\/2023\/02\/inmotion-hosting-logo-yoast.jpg\",\"width\":696,\"height\":696,\"caption\":\"InMotion Hosting\"},\"image\":{\"@id\":\"https:\/\/www.inmotionhosting.com\/support\/#\/schema\/logo\/image\/\"},\"sameAs\":[\"https:\/\/www.facebook.com\/inmotionhosting\/\",\"https:\/\/x.com\/InMotionHosting\"]},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.inmotionhosting.com\/support\/#\/schema\/person\/d850efb28ef3573db7d24b0d8fa9eaed\",\"name\":\"Scott Mitchell\",\"url\":\"https:\/\/www.inmotionhosting.com\/support\/author\/scott\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"rm command | InMotion Hosting","description":"Learn to use the Linux rm command.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.inmotionhosting.com\/support\/server\/linux\/rm-command\/","og_locale":"en_US","og_type":"article","og_title":"rm command | InMotion Hosting","og_description":"Learn to use the Linux rm command.","og_url":"https:\/\/www.inmotionhosting.com\/support\/server\/linux\/rm-command\/","og_site_name":"InMotion Hosting Support Center","article_publisher":"https:\/\/www.facebook.com\/inmotionhosting\/","article_published_time":"2014-06-27T14:16:29+00:00","author":"Scott Mitchell","twitter_card":"summary_large_image","twitter_creator":"@InMotionHosting","twitter_site":"@InMotionHosting","twitter_misc":{"Written by":"Scott Mitchell","Est. reading time":"2 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.inmotionhosting.com\/support\/server\/linux\/rm-command\/#article","isPartOf":{"@id":"https:\/\/www.inmotionhosting.com\/support\/server\/linux\/rm-command\/"},"author":{"name":"Scott Mitchell","@id":"https:\/\/www.inmotionhosting.com\/support\/#\/schema\/person\/d850efb28ef3573db7d24b0d8fa9eaed"},"headline":"rm command","datePublished":"2014-06-27T14:16:29+00:00","mainEntityOfPage":{"@id":"https:\/\/www.inmotionhosting.com\/support\/server\/linux\/rm-command\/"},"wordCount":314,"commentCount":0,"publisher":{"@id":"https:\/\/www.inmotionhosting.com\/support\/#organization"},"articleSection":["Linux"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.inmotionhosting.com\/support\/server\/linux\/rm-command\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.inmotionhosting.com\/support\/server\/linux\/rm-command\/","url":"https:\/\/www.inmotionhosting.com\/support\/server\/linux\/rm-command\/","name":"rm command | InMotion Hosting","isPartOf":{"@id":"https:\/\/www.inmotionhosting.com\/support\/#website"},"datePublished":"2014-06-27T14:16:29+00:00","description":"Learn to use the Linux rm command.","breadcrumb":{"@id":"https:\/\/www.inmotionhosting.com\/support\/server\/linux\/rm-command\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.inmotionhosting.com\/support\/server\/linux\/rm-command\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.inmotionhosting.com\/support\/server\/linux\/rm-command\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.inmotionhosting.com\/support\/"},{"@type":"ListItem","position":2,"name":"rm command"}]},{"@type":"WebSite","@id":"https:\/\/www.inmotionhosting.com\/support\/#website","url":"https:\/\/www.inmotionhosting.com\/support\/","name":"InMotion Hosting Support Center","description":"Web Hosting Support &amp; Tutorials","publisher":{"@id":"https:\/\/www.inmotionhosting.com\/support\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.inmotionhosting.com\/support\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/www.inmotionhosting.com\/support\/#organization","name":"InMotion Hosting","url":"https:\/\/www.inmotionhosting.com\/support\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.inmotionhosting.com\/support\/#\/schema\/logo\/image\/","url":"https:\/\/www.inmotionhosting.com\/support\/wp-content\/uploads\/2023\/02\/inmotion-hosting-logo-yoast.jpg","contentUrl":"https:\/\/www.inmotionhosting.com\/support\/wp-content\/uploads\/2023\/02\/inmotion-hosting-logo-yoast.jpg","width":696,"height":696,"caption":"InMotion Hosting"},"image":{"@id":"https:\/\/www.inmotionhosting.com\/support\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/inmotionhosting\/","https:\/\/x.com\/InMotionHosting"]},{"@type":"Person","@id":"https:\/\/www.inmotionhosting.com\/support\/#\/schema\/person\/d850efb28ef3573db7d24b0d8fa9eaed","name":"Scott Mitchell","url":"https:\/\/www.inmotionhosting.com\/support\/author\/scott\/"}]}},"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"primary_category":null,"_links":{"self":[{"href":"https:\/\/www.inmotionhosting.com\/support\/wp-json\/wp\/v2\/posts\/3328","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.inmotionhosting.com\/support\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.inmotionhosting.com\/support\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.inmotionhosting.com\/support\/wp-json\/wp\/v2\/users\/8"}],"replies":[{"embeddable":true,"href":"https:\/\/www.inmotionhosting.com\/support\/wp-json\/wp\/v2\/comments?post=3328"}],"version-history":[{"count":0,"href":"https:\/\/www.inmotionhosting.com\/support\/wp-json\/wp\/v2\/posts\/3328\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.inmotionhosting.com\/support\/wp-json\/wp\/v2\/media?parent=3328"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.inmotionhosting.com\/support\/wp-json\/wp\/v2\/categories?post=3328"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.inmotionhosting.com\/support\/wp-json\/wp\/v2\/tags?post=3328"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}