From: Siraaj Khandkar Date: Tue, 23 Apr 2019 15:07:18 +0000 (-0400) Subject: Add function to find top disk-using files X-Git-Url: https://git.xandkar.net/?p=khome.git;a=commitdiff_plain;h=27456eb6c27c4f0a0d4eb6fb412f3bb514e1a959 Add function to find top disk-using files --- diff --git a/home/lib/login_functions.sh b/home/lib/login_functions.sh index 13a2ba2..9b8b863 100644 --- a/home/lib/login_functions.sh +++ b/home/lib/login_functions.sh @@ -15,6 +15,21 @@ tdu() { | cut -c 1-115 } +# Top Disk-Using Files +tduf() { + find "$1" -type f -printf '%s\t%p\0' \ + | sort -z -n -k 1 -r \ + | head -z -n 50 \ + | gawk -v RS='\0' ' + { + size = $1 + path = $0 + sub("^" $1 "\t+", "", path) + gb = size / 1024 / 1024 / 1024 + printf("%f\t%s\n", gb, path) + }' +} + # Most-recently modified file system objects recent() { # NOTES: