{"id":12054,"date":"2021-11-18T05:40:42","date_gmt":"2021-11-18T05:40:42","guid":{"rendered":"https:\/\/linuxways.net\/?p=12054"},"modified":"2024-03-25T02:10:45","modified_gmt":"2024-03-25T02:10:45","slug":"rm-command-in-linux","status":"publish","type":"post","link":"https:\/\/linuxways.net\/de\/centos\/rm-command-in-linux\/","title":{"rendered":"rm command in Linux"},"content":{"rendered":"<h2>Introduction<\/h2>\n<p>rm stands for remove. It is a command that allows you to remove files, folders, symlinks from the system. Deleted files and folders will not be moved to the recycle bin, but the rm command will delete them immediately. You must be careful before using this command.<\/p>\n<p>And we will show you how to check the manual by using the rm command in Linux as you go through it below.<\/p>\n<h2><a id=\"post-12054-_lvz8uleuv7cz\"><\/a>The syntax of rm command<\/h2>\n<pre>$ rm [option]... file...<\/pre>\n<p>For example, I have 2 files: a.txt and b.txt<br \/>\n<img loading=\"lazy\" decoding=\"async\" width=\"1041\" height=\"74\" class=\"wp-image-12065\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2021\/11\/word-image-261.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2021\/11\/word-image-261.png 1041w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/11\/word-image-261-300x21.png 300w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/11\/word-image-261-1024x73.png 1024w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/11\/word-image-261-768x55.png 768w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/11\/word-image-261-1020x74.png 1020w\" sizes=\"auto, (max-width: 1041px) 100vw, 1041px\" \/><\/p>\n<p>Now, I will remove file a.txt:<\/p>\n<pre>\r\n$ rm a.txt\r\n<\/pre>\n<p>Output:<br \/>\n<img loading=\"lazy\" decoding=\"async\" width=\"1042\" height=\"84\" class=\"wp-image-12066\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2021\/11\/word-image-262.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2021\/11\/word-image-262.png 1042w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/11\/word-image-262-300x24.png 300w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/11\/word-image-262-1024x83.png 1024w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/11\/word-image-262-768x62.png 768w\" sizes=\"auto, (max-width: 1042px) 100vw, 1042px\" \/><\/p>\n<p>As you can see. the a.txt file has been lost.<\/p>\n<p>Or you can remove multiple files:<\/p>\n<pre>\r\n$ rm b.txt datefile.txt\r\n<\/pre>\n<p>Output:<br \/>\n<img loading=\"lazy\" decoding=\"async\" width=\"1042\" height=\"86\" class=\"wp-image-12067\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2021\/11\/word-image-263.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2021\/11\/word-image-263.png 1042w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/11\/word-image-263-300x25.png 300w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/11\/word-image-263-1024x85.png 1024w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/11\/word-image-263-768x63.png 768w\" sizes=\"auto, (max-width: 1042px) 100vw, 1042px\" \/><\/p>\n<h2><a id=\"post-12054-_6uf72v6rn8ql\"><\/a>Options<\/h2>\n<p><strong>1. -i<\/strong>: must confirm before deleting<\/p>\n<p>For example, I will remove file c.txt:<\/p>\n<pre>\r\n$ rm -i c.txt\r\n<\/pre>\n<p>Output:<br \/>\n<img loading=\"lazy\" decoding=\"async\" width=\"1042\" height=\"150\" class=\"wp-image-12068\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2021\/11\/word-image-264.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2021\/11\/word-image-264.png 1042w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/11\/word-image-264-300x43.png 300w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/11\/word-image-264-1024x147.png 1024w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/11\/word-image-264-768x111.png 768w\" sizes=\"auto, (max-width: 1042px) 100vw, 1042px\" \/><\/p>\n<p>You must press y to confirm.<\/p>\n<p><strong>2. -r<\/strong>: remove a directory<\/p>\n<p>For example, I will remove directory snort3:<\/p>\n<pre>\r\n$ rm -r snort3\r\n<\/pre>\n<p>Output:<br \/>\n<img loading=\"lazy\" decoding=\"async\" width=\"1043\" height=\"231\" class=\"wp-image-12069\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2021\/11\/word-image-265.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2021\/11\/word-image-265.png 1043w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/11\/word-image-265-300x66.png 300w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/11\/word-image-265-1024x227.png 1024w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/11\/word-image-265-768x170.png 768w\" sizes=\"auto, (max-width: 1043px) 100vw, 1043px\" \/><\/p>\n<p><strong>3. &#8211;version<\/strong>: check your version<\/p>\n<pre>\r\n$ rm --version\r\n<\/pre>\n<p>Output:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"1043\" height=\"208\" class=\"wp-image-12070\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2021\/11\/word-image-266.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2021\/11\/word-image-266.png 1043w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/11\/word-image-266-300x60.png 300w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/11\/word-image-266-1024x204.png 1024w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/11\/word-image-266-768x153.png 768w\" sizes=\"auto, (max-width: 1043px) 100vw, 1043px\" \/><\/p>\n<h2><a id=\"post-12054-_c1b3ooyxvhxg\"><\/a>Conclusion<\/h2>\n<p>Hope you understood the tutorial on how to use the rm command in Linux.<\/p>\n<p>Thanks for reading!<\/p>","protected":false},"excerpt":{"rendered":"<p>Introduction rm stands for remove. It is a command that allows you to remove files, folders, symlinks from the system. Deleted files and folders will not be moved&hellip;<\/p>","protected":false},"author":110,"featured_media":12071,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1,4,5,168,2],"tags":[35,361],"class_list":["post-12054","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-centos","category-debian","category-mint","category-scripting","category-ubuntu","tag-linux","tag-linux-commands"],"_links":{"self":[{"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/posts\/12054","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/users\/110"}],"replies":[{"embeddable":true,"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/comments?post=12054"}],"version-history":[{"count":0,"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/posts\/12054\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/media\/12071"}],"wp:attachment":[{"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/media?parent=12054"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/categories?post=12054"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/tags?post=12054"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}