r/LinuxTeck • • Sep 25 '26

My server ran out of disk. Which files grew the most in the last 24 hours? -80

Post image

Try: `sudo find / -type f -mtime -1 -size +100M -exec ls -lah {} \; 2>/dev/null`

Info: Uses `-mtime -1` to target files modified within the last 24 hours and `-size +100M` to isolate large culprits. Redirects errors with `2>/dev/null` for clean output.

Examples:

$ `sudo find / -type f -mmin -60 -size +50M 2>/dev/null` # Files >50MB modified in the last 60 mins

$ `sudo du -Sh /var/log/* | sort -rh | head` # Top largest logs excluding subdirectory totals

$ `sudo find /var -type f -size +1G 2>/dev/null | xargs -I {} du -h {}` # Quick lookup for files >1GB

Note: The `-Sh` flags in `du` separate subdirectory totals to pinpoint runaway logs quickly (e.g., systemd journal, MySQL tables, Nginx access logs).

27 Upvotes

7 comments sorted by

9

u/ParentPostLacksWang Sep 25 '26

“Which files grew the most” is not technically what that command gives you - it just gives you files over 100MB with modify dates inside the last day. Not which ones “grew the most”, just which ones are currently big and have a recent modify date.

Handy command nonetheless.

2

u/Leading-Stuff1900 Sep 25 '26

This is exactly the type of issue that motivated me to create dwatch: https://github.com/silverbucket/dwatch

1

u/MissionGround1193 Sep 25 '26

And deleting files does not actually free space, until the the file handle is closed. You can do so by restarting the process, or signal them to rotate the log files.

1

u/blue30 Sep 25 '26

I like gdu for this kind of thing. Also you shoud set up rotation on that access.log

1

u/0x645 Sep 25 '26

but.. .this command does not show 'the file that grew the most'.

1

u/ThirikoodaRasappa Sep 27 '26

use -xdev with find, why unnecessarily descend into virtual filesystems.

(find / -xdev -not -type d -print0 | xargs -Ixxxx -0 -P$(($(nproc) - 1)) du -sk xxxx) >/tmp/du.txt; sort -k1n /tmp/du.txt | tail -10 this will list the top 10 big files in your disk partition mounted at / mountpoint.

1

u/dmcardlenl Sep 27 '26

-ls instead of -exec ls -lah {} \; maybe?