views:

18

answers:

1

How can we find the number of blocks occupied by a file from userspace ? Is there a command to do so or we need to access the inode structure and then fetch the information.

I have searched a lot on the internet but could not find a valid answer. Can you please let me know

Thanks.

A: 
ls -s

answers this question from command line.

stat(2)

answers it from C or C++.

bmargulies