Skip to main content

How to see/determine on disk file size on Linux? [Resolved]

On windows you can see the size actual size of a file/directory and the size on disk, this size on disk depends on block size.

How can I see this on Linux (mint)?

I have disk with thousands of pictures with varied sizes.

I want to see their actual size and the space they take up on disk, especially directories. On windows the difference can be in gigabytes of wasted space.


Question Credit: user3130012
Question Reference
Asked October 15, 2017
Posted Under: Unix Linux
29 views
1 Answers

I think what you are looking for is du. Executing du -s <directory> shows you much disk space a directory's contents use up. du can also count the sizes of each file in the directory individually and tell you how big their total content is:

du -s --apparent-size <directory>

If you want to know the amount of "wasted" space resulting from allocation in blocks, just subtract the second command's result from the first's.

Note: --apparent-size reports the size in kilobytes. You can use the -b flag instead, if you want to know the exact number of bytes a file contains. This is useful if you want to know how many bytes (without headers and such) you would need to send over the network to deliver the file, for example.


credit: PawkyPenguin
Answered October 15, 2017
 
Thank you. du is what I was looking for. The combo. du -sh <directory> for space on disk du -b <directory> for actual size – user3130012 15 hours ago
 CanDoerz  1 month ago
Your Answer