Sort of handy
leancrew.com
leancrew.com
Slightly cleaner solution would be something like
du | sort | numfmt
(with appropriate flags)https://www.gnu.org/software/coreutils/manual/html_node/numf...
`sort -h` is only needed because `du -h` is used in the first place. I admit that `du -h` comes in handy often, it is better not used for further processing.
Your proposed approach is not only more Unix-like, but also does not require bloated implementations of `du` and `sort` capable of parsing human-readable size indications.
I'd posit that once you use -h or equivalent, any further processing by a NON-HUMAN that works the way you want is a lucky side effect.
I wish there was a common command-line tool for "where did all my space go?" It could look at file and directory sizes and modification times, and list the most likely suspects.
du -ha ~ | sort -hr | head -n 12
-a is the important bit, it recurses down through every directory.
Replace ~ with / or whatever directory you want.
-a, --all
write counts for all files, not just directories alias dua="du -cmx --max-depth=1"
alias duas="du -cmx --max-depth=1 | sort -g" dpkg-query -W --showformat='${Installed-Size} ${Package} ${Status}\n' | grep -v deinstall | sort -n | awk '{print $1" "$2}'
I wish there were a shell with visual help to build such commands. Meanwhile I slowly add useful combinations as aliases in .*rc And probably use "Disk Usage Analyser" (baobab) for this.Perhaps my most infuriating run-in with UNIX ever has been having to use AIX for the first time and dealing with non-GNU du, find, grep, etc.. oh my.
Linux: "killall sends a signal to all processes running any of the specified commands."
AIX: "The killall command cancels all processes that you started"
So, if you're root... good riddance to your system!