From charlesreid1

Sysadmin stuff:

One liner to sort all the directories in the root directory, by size, human-readable, and also not complain:

du -s * 2>/dev/null | sort -n | awk '{print $2;}' | xargs -n1 du -hs 2>/dev/null

This runs du in non-human readable format (total bytes), piping errors into the Linux boo box /dev/null, then sorts numerically, extracts the filenames, and runs the du -hs (human-readable du) on the output, again piping errors to the boo box.

Result:

# du -s * 2>/dev/null | sort -n | awk '{print $2;}' | xargs -n1 du -hs 2>/dev/null
0	dev
0	initrd.img
0	initrd.img.old
0	proc
0	sys
0	vmlinuz
0	vmlinuz.old
4.0K	lib64
4.0K	media
4.0K	mnt
4.0K	opt
16K	lost+found
52K	srv
132K	root
1.6M	tmp
11M	etc
12M	sbin
13M	bin
202M	run
560M	lib
14.1G	var
16.2G	usr
41G	home