Remove a directory

From Attie's Wiki
(Difference between revisions)
Jump to: navigation, search
(Created page with 'How do I remove a full directory in Linux? Question: How do I remove a full directory in Linux? Answer: To remove a directory that is full with other files and/or other direc…')
 
m
 
(5 intermediate revisions by 2 users not shown)
Line 1: Line 1:
How do I remove a full directory in Linux?
+
To remove a directory, use the command below:
  
Question:
+
<pre>
 +
$ rm -rf <directory>
 +
</pre>
  
How do I remove a full directory in Linux?
+
In the above example, you would replace "<directory>" with the name of the directory you wish to delete.
  
Answer:
+
<code>-rf</code> specifies <b>r</b>ecursive and <b>f</b>orce
 
+
To remove a directory that is full with other files and/or other directories, use the below command.
+
 
+
rm -r directory
+
 
+
Note: In the above example, you would replace "directory" with the name of the full directory you wish to delete. So if the directory was named files, you would type: rm -r files
+
 
+
Additional information:
+
 
+
When attempting to remove a directory using a command such as the rmdir command, you may receive a prompt such as "rmdir: 'dir': Directory not empty" and be unable to delete the directory.
+
 
+
See our rm and rmdir commands for additional information about each of these commands and other available switches.
+

Latest revision as of 13:38, 16 October 2010

To remove a directory, use the command below:

$ rm -rf <directory>

In the above example, you would replace "<directory>" with the name of the directory you wish to delete.

-rf specifies recursive and force

Personal tools
Namespaces

Variants
Actions
Navigation
Toolbox