In Linux operating system, to find and print the name of all files that has the file size 0 (zero) bytes, in a directory and all its sub-directories recursively, use one of the following commands:

find /path/to/directory/ -size 0 -type f

Or,

find /path/to/directory/ -size 0 -type f -print

Replace /path/to/directory/ with actual directory that you want to check. You can use “.” (dot without quotes) to list all files with file size of 0 bytes in the current directory. The “-type f” argument specifies that only regular file type is returned, excluding other file types such as symbolic link, socket, directory, named pipe and etc. Some Linux distributions may require “-print” command to print out the filenames.

To filter and display just files with certain pattern, for example, only files with .log file extension, use “-name” option:

find /path/to/directory/ -size 0 -type f -name "*.log"

Once you have view and verify the list of files that have file size 0, you can easily delete all of them by appending the ‘-delete’ option. For example:

find /path/to/directory/ -size 0 -type f -delete