Add function to find top disk-using files
authorSiraaj Khandkar <siraaj@khandkar.net>
Tue, 23 Apr 2019 15:07:18 +0000 (11:07 -0400)
committerSiraaj Khandkar <siraaj@khandkar.net>
Tue, 23 Apr 2019 15:07:18 +0000 (11:07 -0400)
home/lib/login_functions.sh

index 13a2ba2..9b8b863 100644 (file)
@@ -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:
This page took 0.022716 seconds and 4 git commands to generate.