Main Content

Looking for files with certain characteristics (Linux / Unix)

Archive - Originally posted on "The Horse's Mouth" - 2008-05-22 06:47:06 - Graham Ellis

I was about to use chown to change the ownership of an entire subdirectory tree that had been passed from one user to another. But - hang on - were there any files there that belonged to someone else for any reason? One way to find out - a find command:

find . -not -user savethetrain -print

"Find all the files in or below the current directory that do not belong to the savethetrain account"

Other options to find include:
-name - look by name
-uid - look by user id
-mtime - look by file modified time
-perms - look by permissions
-size - look by file size