Tuesday 7 January 2014

Linux Command in detail - find

find command is a useful tool to find the file in a location.

The basic command is like:
find pathname -options [action]
  • pathname : the path you want to search
  • options: will be explained in detailed later
  • actions: will be explained in detailed later


options in detail:

Option
Explaination
-name
By file name, wildcard applied
-perm
By permission
-user
By ownership(user)
-group
By ownership(group)
-depth
Find in current directory, then the subfolder
-mtime
By modified time, (days) +n n days before. –n n days ‘after’
-ctime
By created time, (days) +n n days before. –n n days ‘after’
-atime
By accessed time, (days) +n n days before. –n n days ‘after’
-nouser/-nogroup
The file owner is not in the system
-type
Match the file typ
b- block d- directory c-character p- pipe l-link f- normal file
-size
+n Bigger than n block   +nc bigger than n byte
-n less than n block      -nc less than n byte
-mount
Do not find across the mount point

Action:

-delete: delete the finding files
-exec: execute the command
-ls: list the file              -fls file --- put the output to some output file
-print: ??

No comments:

Post a Comment