This question already has an answer here:
- Determine the size of a block device 14 answers
I need to be able to determine the size of a block special file.
For example, given
/dev/sda, I need a command that will provide the size of the device. (By size I mean capacity, since this is a storage device.)
I can store information in the device with:
echo "12345" >/dev/sda # needs to be run as root
(Don't run that command by the way... unless you don't care about your data.)
However, I need to know how much data I can store on the device and I don't know how to do that.