Linux: Find all the text files in a directory

I need to find all the text files in a given directory for potential clean up. There is not a super easy way to find only text files, but I came up with a hacky solution:

# Using `fd` (new hotness)
fd . /tmp/ --exec file {} + | grep -P ":.*text" | cut -d: -f1

# Using old school `find` (old and busted)
find /tmp/ -exec file {} + | grep -P ":.*text" | cut -d: -f1

These rely on the file command to determine what the filetype is.



Note: Replies will be formatted with PHP Markdown Extra syntax.

Name: Email (Not Required):
 
Logged IP: 216.73.216.245
To prevent spam please submit by clicking the kitten: