Wed 27 Jan 21 in Coding

List files from the current directory and display the size

#Snippets

Code example


du --max-depth=1 | sort -n | awk 'BEGIN {OFMT = "%.0f"} {print $1/1024,"MB", $2}'

 

Results example

...

0 MB ./ssh
0 MB ./sysconfig
1 MB ./fail2ban
2 MB ./pki
7 MB ./udev
20 MB ./selinux
...