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)

Comments

Popular posts from this blog

Pull files off Android phone