Difference between revisions of "Find"
From Linuxintro
imported>ThorstenStaerk |
imported>ThorstenStaerk (find files newer/older than...) |
||
Line 3: | Line 3: | ||
= find by time = | = find by time = | ||
− | == find files older than ... == | + | == find files older than... == |
− | To find files in ''folder'' that | + | To find files in ''folder'' that have been changed more than ''1'' day ago use |
− | find ''folder'' -ctime | + | find ''folder'' -ctime 1 |
− | To find how old a file is, use the [[command]] [[stat]]. | + | To find out how old a file is, use the [[command]] [[stat]]. |
− | == | + | == find files newer than... == |
− | To find files | + | To find files in ''folder'' that have been changed less than ''1'' day ago use |
− | find | + | find ''folder'' -ctime -1 |
− | To find | + | To find out how old a file is, use the [[command]] [[stat]]. |
− | |||
= find files that have content = | = find files that have content = |
Revision as of 08:36, 19 October 2012
Find allows you to find files, e.g.
Contents
find by time
find files older than...
To find files in folder that have been changed more than 1 day ago use
find folder -ctime 1
To find out how old a file is, use the command stat.
find files newer than...
To find files in folder that have been changed less than 1 day ago use
find folder -ctime -1
To find out how old a file is, use the command stat.
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.
Do something with the file
find . -name '*.mp3' -exec echo "Do something with the file" {} \;