Linux: Find command with "or"

Linux has a very powerful find command, but it can be daunting to get all the options right. Recently I needed to find all my new .txt and .pl files. To do this you need to be able to say "find all the files that are text OR perl". In Linux find that looks like:

find /dir/path/ -type f \( -name '*.txt' -or -name '*.pl' \) -ctime -7

The spaces after and before the surrounding parenthesis are required or you will get weird error messages. Lots of research and examples borrowed from geeksforgeeks.org.



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

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