Using find to locate all zero length files

Posted in Linux/Unix/BSD and Quick Tips -

A little while ago I posted how to use the Linux/Unix/OSX find command to locate files bigger or smaller than a particular size but didn't cover how to find zero length files. This is shown here.

Find zero length files

It's very easy, just like so:

find . -size 0

"find" is obviously the command itself.

The . means start searching from the current directory. If you wanted to find files from another directory then replace the . with the directory. For example to search everything under the system log directory then "find /var/log <other parameters>" is what you would do.

Finally the "-size 0" flag specifies just to find zero length files.

Related posts: