Linux Rm A Folder And Contents

by Vivek Gite on November 19, 2007 · 1 comment

How do I remove a folder and all its contents including files and other folders?

You need to use the rm command. Use the -r option to remove the listed directories and their contents recursively. The syntax is:

 
rm -rf dirName
 

In this example, remove data directory and their contents recursively, enter:

 
rm -rf data
 

See also:

See the rm command man page for more information:
man rm

Featured Articles:

Share this with other sys admins!
Facebook it - Tweet it - Print it -

{ 1 comment… read it below or add one }

1 Philippe Petrinko May 18, 2010

Typos here:
“m” instead of “rm” ! ;-)

Reply

Leave a Comment

You can use these HTML tags and attributes for your code and commands: <strong> <em> <ol> <li> <u> <ul> <blockquote> <pre> <a href="" title="">
What is 11 + 11 ?
Please leave these two fields as-is:
Solve the simple math so we know that you are a human and not a bot.




Previous post:

Next post: