This tutorial explains Linux “rmdir” command, options and its usage with examples.
rmdir – remove empty directories.
This command is used to remove the DIRECTORY(ies), if they are empty.
rmdir [OPTION]… DIRECTORY…
Remove DIRECTORY and its ancestors. E.g., ‘rmdir -p a/b/c’ is similar to ‘rmdir a/b/c a/b a’.
Removes the directory mydir.
$ rmdir -p mydir1/mydir2/mydir3/
Removes the directory mydir3 and its parents(mydir2 & mydir1) too recursively if they are empty.
Sanfoundry Global Education & Learning Series – 1000 Linux Tutorials.
Participate in the Sanfoundry Certification contest
to get free Certificate of Merit. Join our social networks below and stay updated with latest contests, videos, internships and jobs!
, a technology veteran with 20+ years @ Cisco & Wipro, is Founder and CTO at Sanfoundry. He is Linux Kernel Developer & SAN Architect and is passionate about competency developments in these areas. He lives in Bangalore and delivers focused training sessions to IT professionals in Linux Kernel, Linux Debugging, Linux Device Drivers, Linux Networking, Linux Storage, Advanced C Programming, SAN Storage Technologies, SCSI Internals & Storage Protocols such as iSCSI & Fiber Channel. Stay connected with him @