How to delete or remove a directory in linux command

FREQUENTLY ASKED QUESTIONS 
Q: How to delete or remove a directory in linux? (Linux commands)


You can remove a directory in linux by "rmdir" command. But it works only if the directory is empty.

Remove/Delete an empty Directory
[root@server ~#]rmdir folder                      (works only if the directory not empty)
(If directory is not empty you may get error like "rmdir: failed to remove `folder': Directory not empty")


Remove/Delete a directory (non empty)
[root@server ~#]rm -rf folder               (it will delete the directory and all its contents)

0 comments:

Related Posts Plugin for WordPress, Blogger...

 
Design by Free WordPress Themes | Bloggerized by Lasantha - Premium Blogger Themes | Bluehost Coupons