≡ Menu

Linux Rm A Folder And Contents

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

Sysadmin because even developers need heroes!!!

Share this tutorial on:
{ 1 comment… add one }
  • Philippe Petrinko May 18, 2010, 12:48 pm

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

Security: Are you a robot or human?

Leave a Comment

You can use these HTML tags and attributes: <strong> <em> <pre> <code> <a href="" title="">


   Tagged with: , , , , , , ,