Difference between revisions of "Find"

From Linuxintro
imported>ThorstenStaerk
imported>ThorstenStaerk
Line 1: Line 1:
 
Find allows you to find files, e.g.
 
Find allows you to find files, e.g.
  
= find files older than ... =
+
= find by time =
 +
 
 +
== find files older than ... ==
 
To find files in ''folder'' that are older than ''5'' days use
 
To find files in ''folder'' that are older than ''5'' days use
 
  find ''folder'' -ctime +''5'' -exec ls {} \;
 
  find ''folder'' -ctime +''5'' -exec ls {} \;
 +
 +
== file modification ==
 +
To find files whose content has been modified ''1'' days ago or earlier use
 +
find . -mtime -1
  
 
= find files that have content =
 
= find files that have content =

Revision as of 22:30, 13 March 2010

Find allows you to find files, e.g.

find by time

find files older than ...

To find files in folder that are older than 5 days use

find folder -ctime +5 -exec ls {} \;

file modification

To find files whose content has been modified 1 days ago or earlier use

find . -mtime -1

find files that have content

find -not -empty -iname "foo*"

find files by content

To find files by content you do not use find, but grep.

See also