Find file or directory (LINUX)

find [pathnames] [conditions]

Conditions:

-amin +n -n n - Find files last accessed more than n (+n), less than n (-n), or exactly n minutes ago.

-atime +n -n n - Find files that were last accessed more than n (+n), less than n (-n), or exactly n days ago.

-cmin +n -n n - Find files last changed more than n (+n), less than n (-n), or exactly n minutes ago.

-cnewer file - Find files that were changed after they were last modified. Affected by -follow when after -follow on the command line.

-ctime +n -n n - Find files that were changed more than n (+n), less than n (-n), or exactly n days ago. A change is anything that changes the directory entry for the file, such as a chmod.

-daystart - Calculate times from the start of the day today, not 24 hours ago.

-depth - Descend the directory tree, skipping directories and working on actual files first, and then the parent directories. Useful when files reside in unwritable directories.

-empty Continue if file is empty. Applies to regular files and directories.

-exec command{ } \ ; - Run the Linux command, from the starting directory on each file matched by find

-false - Return false value for each file encountered.

-follow - Follow symbolic links and track the directories visited.

-fstype type - Match files only on type filesystems.

-group gname - Find files belonging to group gname. gname can be a group name or a group ID number.

-maxdepth num - Do not descend more than num levels of directories.

-mindepth num - Begin applying tests and actions only at levels deeper than num levels.

-mmin +n -n n - Find files last modified more than n (+n), less than n (-n), or exactly n minutes ago

-newer file - Find files that were modified more recently than file; similar to -mtime.

-nogroup - The file's group ID does not correspond to any group.

-noleaf - find assumes that each directory has at least two hard links that should be ignored

-nouser - The file's user ID does not correspond to any user.

-perm nnn - Find files whose permission flags match octal number nnn exactly

-print - Print the matching files and directories, using their full pathnames.

-size n[c] - Find files containing n blocks, or if c is specified, n characters long.

-type c - Find files whose type is c. c can be b (block special file), c (character special file), d (directory), p (fifo or named pipe), l (symbolic link), s (socket), or f (plain file).

-user user - Find files belonging to user.

No comments:

Recent Posts