Linux delete directory with rmdir command
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:
- Delete or remove a directory Linux command
- Linux or Unix find and remove files with one find command on fly
- Ubuntu Linux: Delete directory command in Terminal
- Linux / UNIX: Delete a file
- Howto: Linux command line utilities for removing blank lines from text files
Discussion on This FAQ
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!
Tags: command_syntax, Linux, recursive_delete, rmdir_command, rm_command, UNIX, unix_delete_directory




September 6th, 2007 at 7:20 am
You can also use rm -rf
October 16th, 2007 at 8:15 am
It,s quite helpful here,but you should be more precise.
May 30th, 2008 at 5:40 am
hi
This is very useful for me
thanks
lakshmi
June 4th, 2008 at 8:41 am
Thanks a lot. Thins really helped me.