rmdir Command in Linux with Examples

This tutorial explains Linux “rmdir” command, options and its usage with examples.

rmdir – remove empty directories.

DESCRIPTION

This command is used to remove the DIRECTORY(ies), if they are empty.

SYNOPSIS

rmdir [OPTION]… DIRECTORY…

advertisement
advertisement

OPTION :

-p, –parents
Remove DIRECTORY and its ancestors. E.g., ‘rmdir -p a/b/c’ is similar to ‘rmdir a/b/c a/b a’.

EXAMPLES

1.

$ rmdir mydir

Removes the directory mydir.

advertisement

2.

$ rmdir -p mydir1/mydir2/mydir3/

Removes the directory mydir3 and its parents(mydir2 & mydir1) too recursively if they are empty.

advertisement

Sanfoundry Global Education & Learning Series – 1000 Linux Tutorials.

If you wish to look at all Linux commands and their usage examples, go to Linux Commands Tutorial.

If you find any mistake above, kindly email to [email protected]

advertisement
advertisement
Subscribe to our Newsletters (Subject-wise). 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!

Youtube | Telegram | LinkedIn | Instagram | Facebook | Twitter | Pinterest
Manish Bhojasia - Founder & CTO at Sanfoundry
Manish Bhojasia, a technology veteran with 20+ years @ Cisco & Wipro, is Founder and CTO at Sanfoundry. He lives in Bangalore, and focuses on development of Linux Kernel, SAN Technologies, Advanced C, Data Structures & Alogrithms. Stay connected with him at LinkedIn.

Subscribe to his free Masterclasses at Youtube & discussions at Telegram SanfoundryClasses.