On Tue, 23 Nov 2004, Mischa Krilov wrote:
> I'm pretty spoiled, I know. Also, due to a long-ago frustration with
> find, my instinct is to type "find /path | grep foo" instead. Must overcome.
I confess i did the same thing before i learned all the stuff find could
do. Most useful when used with -exec... here's the most common things i
use it for:
Delete all tmp*.html files:
fine . -name 'tmp*.html' -exec rm -rf {} \;
Need to chown all files owned by uid 501 to ray (when i moved from redhat
to debian, my uid changed from 501 to 1000):
find / -uid 501 -exec chown ray.ray {} \;
Delete files that haven't changed in 14 days:
find /tmp -mtime +14 -exec rm -rf {} \;
Show me all files bigger than 50 megs (512-byte blocks):
find . -size +100000 -ls
Show me all the SUID root or SGID root files on my system
find / \( -perm 4755 -o -perm 2755 \) -uid 0 -ls
When a file has control characters in its filename and you can't delete
it, and tab complete won't work, delete it by it's inode number. ls -li
to get inode, then
find . -inum 123456 -exec rm -rf {} \;
ray
-- =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= Ray DeJean http://www.r-a-y.org Systems Engineer Southeastern Louisiana University IBM Certified Specialist AIX Administration, AIX Support =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= ___________________ Nolug mailing list nolug@nolug.orgReceived on 11/24/04
This archive was generated by hypermail 2.2.0 : 12/19/08 EST