(Modified 2009 Nov 19)
I've seen two syntaxes:
find dir_name/ string*ext -print
find "string*ext" -print
In the first, the directory name to be searched must be named explicitly. In the second, the directory names is optional, but the string must be enclosed in quotes. I'll be general and include both the directory name and enclose in quotes.
find . -name "*pattern*" -print
find . -name "*pattern*" -type d -printTo find normal files, change the d to f.
find . -name "*pattern*" -type d -print
find . -name "*pattern*" -type d -print | sort
find -name "*pattern*" -printf "%t %p\n"where:
find -name "*pattern*" -printf "%T+ %p\n"
find -name "*pattern*" -printf "%T+ %p\n" | sort
find -name "*pattern*" -printf "%s bytes %p\n"
find -name "*pattern*" -printf "%s bytes %p\n" | sort -nWithout the flag -n, the sort command would simply sort by the first digit, then by tiebreakers, even if the file sizes have different numbers of digits.
This page is Lynx-enhanced