I am using du -h --max-depth=2 to get list of folders by size upto 2 levels down. Problem is I am not able to sort them in max folder size.
Normally this can be achieved by using du -k | sort -nr * but I can't use it here since it conflicts (the -s argument) with the --max-depth=2 argument.
Can someone please suggest if there is any other way to achieve this. I need to keep the list in human readable format though.
478M var
500K usr/sdfijf/best
568K user/dbuser
56M etc/basic/linux
68K var/redhat
9.0K user/aunix
I have following two columns and was expecting to sort them by the human readable folder size with biggest folders being on top (so descending and reverse order basically)
Thanks,
Morgan