About Linux FAQ

Browse More FAQs:

Linux delete directory with rmdir command

Posted by Vivek Gite [Last updated: September 5, 2007]

Q. I'm new to Linux and I'd like to know how to delete directory? I'm using Cent OS Linux.

A. You need to use command called rmdir. It remove empty directories

rmdir command syntax

rmdir [OPTION] {directory-name}

Delete / remove directory

To delete directory called foo, enter:
rmdir foo

Remove DIRECTORY and its ancestors

For example remove directory structure sales/99/march
rmdir -p sales/99/march

Recursive delete

Remove all directories and subdirectories, use rm command with -r option:
rm -rf /home/data/2000

Please note that rmdir command works with all Linux and Unix like operating systems. For more information read rm and rmdir command man pages:
man rm
man rmdir

E-mail this to a friend      Printable version

Related Other Helpful FAQs:

Discussion on This FAQ

  1. Zootropo Says:

    You can also use rm -rf

  2. Chandrabhanu Mahapatra Says:

    It,s quite helpful here,but you should be more precise.

  3. lakshmikanthan Says:

    hi
    This is very useful for me
    thanks
    lakshmi

  4. Kamal Says:

    Thanks a lot. Thins really helped me.

Leave a Reply

We encourage your comments, and suggestions. But please stay on topic, be polite, and avoid spam. Thank you very much for stopping by our site!

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

*
To prove you're a person (not a spam script), type the security word shown in the picture. Click on the picture to hear an audio file of the word.
Click to hear an audio file of the anti-spam word

Tags: , , , , , ,

Copyright © 2006-2008 nixCraft. All rights reserved - TOS/Disclaimer - Privacy policy - Sitemap - Powered by Open source software.