Monday, May 30, 2011

Find Command in Linux With Options.

If you find root only
find /. -size +100M

-size n[cwbkMG]
              File uses n units of space.  The following suffixes can be used:

              ‘b’    for 512-byte blocks (this is the default if no suffix is used)

              ‘c’    for bytes

              ‘w’    for two-byte words

              ‘k’    for Kilobytes (units of 1024 bytes)

              ‘M’    for Megabytes (units of 1048576 bytes)

              ‘G’    for Gigabytes (units of 1073741824 bytes)

              The size does not count indirect blocks, but it does count blocks in sparse  files  that  are  not
              actually  allocated.   Bear  in  mind  that  the ‘%k’ and ‘%b’ format specifiers of -printf handle
              sparse files differently.  The ‘b’ suffix always denotes 512-byte  blocks  and  never  1  Kilobyte
              blocks, which is different to the behaviour of -ls.

       -true  Always true.

If you want to find in perticuler other directory.

find /usr/local/ -size +100M  
find /var/ -size +100M
find /mnt/ -size +100M
find /opt/ -size +100M

Daywise find.file modified 6 days ago.
find /var/ -mtime 6

Show all files which is modified with in 24 hours.
find /.  -atime +1


   TESTS
       Numeric arguments can be specified as

       +n     for greater than n,

       -n     for less than n,

       n      for exactly n.

       -amin n
              File was last accessed n minutes ago.

       -anewer file
              File  was  last accessed more recently than file was modified.  If file is a symbolic link and the
              -H option or the -L option is in effect, the access time of the file it points to is always  used.

       -atime n
              File  was  last  accessed  n*24 hours ago.  When find figures out how many 24-hour periods ago the
              file was last accessed, any fractional part is ignored, so to match -atime +1, a file has to  have
              been accessed at least two days ago.

       -cmin n
              File’s status was last changed n minutes ago.

       -cnewer file
              File’s  status  was last changed more recently than file was modified.  If file is a symbolic link
              and the -H option or the -L option is in effect, the status-change time of the file it  points  to
              is always used.

       -ctime n
              File’s  status  was  last  changed  n*24 hours ago.  See the comments for -atime to understand how
              rounding affects the interpretation of file status change times.

       -empty File is empty and is either a regular file or a directory.

       -false Always false.

       -fstype type
              File is on a filesystem of type type.  The valid filesystem types vary among different versions of
              Unix;  an incomplete list of filesystem types that are accepted on some version of Unix or another
 -ilname pattern
              Like  -lname,  but  the  match  is case insensitive.  If the -L option or the -follow option is in
              effect, this test returns false unless the symbolic link is broken.

       -iname pattern
              Like -name, but the match is case insensitive.  For example, the patterns ‘fo*’  and  ‘F??’  match
              the  file names ‘Foo’, ‘FOO’, ‘foo’, ‘fOo’, etc.   In these patterns, unlike filename expansion by
              the shell, an initial ’.’ can be matched by ’*’.  That is, find -name *bar  will  match  the  file
              ‘.foobar’.   Please note that you should quote patterns as a matter of course, otherwise the shell
              will expand any wildcard characters in them.

       -inum n
              File has inode number n.  It is normally easier to use the -samefile test instead.

       -ipath pattern
              Behaves in the same way as -iwholename.  This option is deprecated, so please do not use it.

       -iregex pattern
              Like -regex, but the match is case insensitive.

       -iwholename pattern
              Like -wholename, but the match is case insensitive.

       -links n
              File has n links.

       -lname pattern
              File is a symbolic link whose contents match shell pattern pattern.   The  metacharacters  do  not
              treat  ‘/’  or  ‘.’  specially.   If  the  -L option or the -follow option is in effect, this test
              returns false unless the symbolic link is broken.

 -lname pattern
              File is a symbolic link whose contents match shell pattern pattern.   The  metacharacters  do  not
              treat  ‘/’  or  ‘.’  specially.   If  the  -L option or the -follow option is in effect, this test
              returns false unless the symbolic link is broken.

       -mmin n
              File’s data was last modified n minutes ago.

       -mtime n
              File’s data was last modified n*24 hours ago.  See the  comments  for  -atime  to  understand  how
              rounding affects the interpretation of file modification times.

       -name pattern
              Base  of  file name (the path with the leading directories removed) matches shell pattern pattern.
              The metacharacters (‘*’, ‘?’, and ‘[]’) match a ‘.’ at the start of  the  base  name  (this  is  a
              change  in  findutils-4.2.2;  see section STANDARDS CONFORMANCE below).  To ignore a directory and
              the files under it, use -prune; see an example in the description of -wholename.  Braces  are  not
              recognised  as being special, despite the fact that some shells including Bash imbue braces with a
              special meaning in shell patterns.  The filename  matching  is  performed  with  the  use  of  the
              fnmatch(3)  library  function.   Don’t forget to enclose the pattern in quotes in order to protect
              it from expansion by the shell.

       -newer file
              File was modified more recently than file.  If file is a symbolic link and the -H option or the -L
              option is in effect, the modification time of the file it points to is always used.

       -nouser
              No user corresponds to file’s numeric user ID.

       -nogroup
              No group corresponds to file’s numeric group ID.

       -path pattern
              See -wholename.   The predicate -path is also supported by HP-UX find.

       -perm mode
              File’s permission bits are exactly mode (octal or symbolic).  Since an exact match is required, if
              you want to use this form for symbolic modes, you may  have  to  specify  a  rather  complex  mode
              string.   For  example  ’-perm  g=w’ will only match files which have mode 0020 (that is, ones for
              which group write permission is the only permission set).  It is more likely that you will want to
              use  the  ’/’ or ’-’ forms, for example ’-perm -g=w’, which matches any file with group write per-
: