Difference between revisions of "Find"

From Useful Things
Jump to: navigation, search
m (Several matches)
Line 9: Line 9:
 
== Several matches ==
 
== Several matches ==
 
<syntaxhighlight lang="bash">
 
<syntaxhighlight lang="bash">
find / -xdev \( -name .DS_Store -o -name ._DS_Store \)
+
find / -xdev \( -name .DS_Store -o -name ._.DS_Store \)
 
</syntaxhighlight>
 
</syntaxhighlight>
 
<code>-xdev</code> stay on the current filesystem<br />
 
<code>-xdev</code> stay on the current filesystem<br />
 
<code>-o</code> logical OR, use parentheses for clarity - must be escaped in bash
 
<code>-o</code> logical OR, use parentheses for clarity - must be escaped in bash

Revision as of 11:15, 9 July 2014

Between dates

find / -newermt "27 Dec 2013" ! -newermt "1 Jan 2014"

-newermt newer than specified modification time
! invert proceeding condition

Several matches

find / -xdev \( -name .DS_Store -o -name ._.DS_Store \)

-xdev stay on the current filesystem
-o logical OR, use parentheses for clarity - must be escaped in bash