sort du -sh by size in human readable

with the command

du -sh *

I get the summary of files in MB,GB, etc. If I use

du -s * | sort -nk1

I get the summary sort by size.
How I can get the summary sort by size in MB, GB, etc?

Edit

the OS is ubuntu

4

1 Answer

If you're using GNU sort, try the following:

du -sh * | sort -hk1,1

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

You Might Also Like