2.1. find options

There are many options or expressions you can use with find, and each option is prefixed with a hyphen ‘-’. Let’s first go over the main options before we do any examples.

-name Find files by filename.
-perm Find files with different access or permission bits on a file.
-prune Use this option to stop find hitting the current dirrectory name specified; however, if you use the -depth option, then prune is ignored.
-user Find files by user ownership.
-group Find files that are a member of a certain group.
-mtime -n +n Find files that were accessed or modified less ‘-’ than or more ‘+’ than x days ago. There is also an atime and ctime option with find, but they all do practically the same thing, so we’ll just look at mtime.

Get Linux and Unix Shell Programming now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.