From 837e0b5b71491c971ac65b9edb758dbf923a1b5c Mon Sep 17 00:00:00 2001 From: nitsnatsnok Date: Sun, 12 Nov 2017 00:50:30 +0100 Subject: [PATCH] sizes and typo corrected MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit `-size +20000k` actually matches files bigger than 20,000*1,024=20,480,000 Bytes, not 20,000,000 Bytes as in “2 Megabytes”. --- cheat/cheatsheets/find | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/cheat/cheatsheets/find b/cheat/cheatsheets/find index 42e886a..d1f0693 100644 --- a/cheat/cheatsheets/find +++ b/cheat/cheatsheets/find @@ -19,11 +19,11 @@ find ./path/ -name '*.txt' -exec rm '{}' \; # To find files with extension '.txt' and look for a string into them: find ./path/ -name '*.txt' | xargs grep 'string' -# To find files with size bigger than 5 Mb and sort them by size: +# To find files with size bigger than 5 Mebibyte and sort them by size: find . -size +5M -type f -print0 | xargs -0 ls -Ssh | sort -z -# 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 bigger than 2 Megabyte and list them: +find . -type f -size +200000000c -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