It’s great - it’s really powerful, but it’s also a monumental PITA to use at times…
Hate is such a strong word, it’s probably more a case of “Love / Hate”…
Take something as simple as figuring out which folder in “/” is eating all your storage :
(probably as root - e.g. via sudo)
find / -mount -xdev -maxdepth 1 -type d -exec du -sh {} \; | sort -h
(should “allegedly” find folders ONLY on the current fileysystem, one level deep and report their usage “summary” in human readable form and sort on human readable form)
But it DOESN’T work - I used BOTH “-mount” and “-xdev” so it doesn’t cross filesystems - BUT IT STILL DOES ANYWAY!
And of course we don’t give a rat’s (contraction of “rat’s arse”) about /proc, or /sys - but to exclude those - we have to end up with a chain of “prune” arguments, one for EVERY directory you want to exclude :
find . -mount -maxdepth 1 -path /sys -prune -o -path /proc -prune -o -type d -exec du -sh {} \; | sort -h
That’s so inelegant…
And - even that doesn’t work (Ubuntu 18.04 server) :
root@REDACTED:/# find . -mount -maxdepth 1 -path /sys -prune -o -path /proc -prune -o -type d -exec du -sh {} \; | sort -h
du: cannot access ‘./proc/12109/task/12109/fd/3’: No such file or directory
du: cannot access ‘./proc/12109/task/12109/fdinfo/3’: No such file or directory
du: cannot access ‘./proc/12109/fd/4’: No such file or directory
du: cannot access ‘./proc/12109/fdinfo/4’: No such file or directory
…
6.1G ./var
8.1G ./home
13G ./usr
39G ./datahub
75G .
See? The F–KING thing is still traversing /proc!!! And even worse? /datahub is an NFS mount from a NAS device - so it’s F–KING ignoring my “-mount” argument (same result using -xdev, or BOTH -mount and -xdev). Note also - same result with either “find .” or “find /” (while $PWD = / ). And that total of 75 G INCLUDES the 39 G from NFS mounted NAS share /datahub…
And it’s even worse… e.g. find in Solaris doesn’t even support case insenstive search, so :
find / -name STRINGstring -print
Won’t return something matching stringSTRING!!!
And having to have multiple escapes for wildcards e.g.
find / -name \*STRING\*string\*
It’s so ugly… So in Solaris - you’d probably have to have a loop to cycle through every possible upper and lowercase variation of that string…
I should probably write a script that does something like the old “hog.exe” (or hog.com) MS-DOS free/shareware utility did - but - how to deploy everywhere I need it? And ensure it works on Linux distros from Debian 4 (yeah some customers STILL running stuff that was already EOL 10+ years ago!) through to RHEL 8 - AND - Solaris 10 and 11!!!