How to Delete Directory in Linux

How to Delete Directory in Linux

In this tutorial we will learn How to Delete Directory in Linux. in Earlier post we have learnt How to Create Directory in Linux.

Deletion of directory works by two ways:

1. Empty directory deletion:

rmdir directory_name

2. Directory with contents in it deletion:

if you tried to delete a directory having content in it by rmdir directory_name. It will through you an error: rmdir: failed to remove `hightechnology1/’: Directory not empty.

So you have to use this for directory having contents:

rm -f directory_name