What is the Linux command-line command that can identify such files?
AFAIK the find
command (or grep
) can only match a specific string inside the text file. But I want to match whole contents, i.e. I want to see which files match regular expression \0+
, ignoring the line end character(s). Maybe the find . cat | grep
idiom could work, but I don't know how to make grep ignoring lines (and treat the file as binary).
Background:
Every few days, when my laptop freezes, my btrfs partition looses information: files opened for write gets their contents replaced with zeroes (the size of the file remains more-or-less intact). I use synchronization and I don't want these fake files to propagate: I need a way to identify them so I can grab them from backup.
Best Answer
You can
grep
for ␀ characters using the Perl regex mode:So you can use this: