How to remove the entire directory in linux comand

The tutorial explains on how to remove empty directories and all subdirectories in Linux operating system.

Linux command:

rm

Remove files (delete/unlink)

SYNTAX
rm [options]… file…

OPTIONS
-d, –directory unlink directory, even if non-empty (super-user only)

-f, –force ignore nonexistent files, never prompt

-i, –interactive prompt before any removal

-r, -R, –recursive remove the contents of directories recursively

-v, –verbose explain what is being done

–help display this help and exit

–version output version information and exit

To remove a file you must have write permission on the file and the folder where it is stored.

rm -rf will recursively remove folders and their contents

The OWNER of a file does not need rw permissions in order to rm it.

Example:
To remove empty directory:

rm foldername

To remove the directory , all its subdirectory and their content :

rm -rf foldername

Share and Enjoy:
  • Digg
  • del.icio.us
  • Facebook
  • Google
  • Furl
  • Reddit
  • Smarking
  • StumbleUpon
  • Technorati
  • TwitThis
  • YahooMyWeb
  • Simpy
  • Propeller
  • Fark
  • LinkedIn
  • Live
  • Mixx

1 Comment »

  1. tnx……

    Comment by nazali — June 17, 2009 @ 5:49 am

RSS feed for comments on this post. TrackBack URL

Leave a comment