From bbab921bf84ec2596537c583419fa7c0fcfc6e11 Mon Sep 17 00:00:00 2001 From: Grant Bremer Date: Sat, 21 Sep 2013 13:39:46 -0400 Subject: [PATCH] Adding additional find commands --- cheatsheets/find | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/cheatsheets/find b/cheatsheets/find index a8ef46b..00c6c86 100644 --- a/cheatsheets/find +++ b/cheatsheets/find @@ -24,3 +24,15 @@ find ./ -size +5M -type f -print0 | xargs -0 ls -Ssh # To find files bigger thank 2 MB and list them: find / -type f -size +20000k -exec ls -lh {} \; | awk '{ print $9 ": " $5 }' + +# To find files modified more than 7 days ago and list file information +find . -type f -mtime +7d -ls + +# To find symlinks owned by a user and list file information +find . -type l --user=username -ls + +# To search for and delete empty directories +find . -type d -empty -exec rmdir {} \; + +# To search for directories named build at a max depth of 2 directories +find . -maxdepth 2 -name build -type d