How do I delete / remove a directory under UNIX operating systems?
You need to use rmdir command to remove a directory. It will remove the directory entry specified by each dirname operand, which must refer to an empty directory.
For example, to remove a directory called "cppcode", enter:
rmdir cppcode
Note: A directory must be empty before it can be removed. Use rm command to remove all files from a directory:
cd cppcode
rm *.cpp
cd ..
rmdir cppcode
You can also recursively remove directories and subdirectories. The directory will be emptied of files and removed using rm command:
rm -r oldletters
Featured Articles:
- 20 Linux System Monitoring Tools Every SysAdmin Should Know
- 20 Linux Server Hardening Security Tips
- My 10 UNIX Command Line Mistakes
- Linux: 20 Iptables Examples For New SysAdmins

- 25 PHP Security Best Practices For Sys Admins
- The Novice Guide To Buying A Linux Laptop
- 10 Greatest Open Source Software Of 2009
- Top 5 Email Client For Linux, Mac OS X, and Windows Users
- Top 20 OpenSSH Server Best Security Practices
- Top 10 Open Source Web-Based Project Management Software
- Top 5 Linux Video Editor Software
Facebook it - Tweet it - Print it -


{ 8 comments… read them below or add one }
Hi thanks..
Thank You
thank u.I want more basic comends in unix
What are the other conditions for deleting/removing directories…….?
Thanks
learning unix begins with deleting directories.
Thanks.
Fantastic! Thank you!