Skip to content
Home » How to Locate empty directories in Linux using Terminal ?

How to Locate empty directories in Linux using Terminal ?

To locate empty directories in Linux using the terminal, we will use the find command with the -empty option. Here is the working command,

The above command will search for empty directories under the specified path /path/to/search or directory.

Locate empty directories in Linux
Locate empty directories in Linux using Terminal

We can also use the -print option to print the names of the empty directories that are found:

By using the -delete option to delete the empty directories that we are found,

Note that the find command is very powerful and has many options and features. You can use the man find command to get more details about how to use it.

Also Read:

Happy Coding..!

Was this article helpful?
YesNo

Leave a Reply

Your email address will not be published. Required fields are marked *