Posts

Showing posts from January, 2013

Get disk size in Linux

Usually, you'll need root , like so: sudo /sbin/fdisk -l | grep -E "^Disk" But you can also use this: printf "%.1f GB\n" $(echo "`cat /sys/block/sd*/size` * 512 / 1000000000" | bc -l)