3

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.

  • Do you plan on recreating your filesystem(s) based on the results, in order to reduce this wasted space? Otherwise, it's a fact of life for most filesystems. – Jeff Schaller Oct 14 '17 at 0:13
  • yes that is what i wanted, to reduce wasted space or even just make two partition with different block sizes, one for video and another for images. because I like the video playback benefits of having huge block sizes(or is it just a placebo effect). – user3130012 Oct 15 '17 at 8:24
2

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.

  • 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 Oct 15 '17 at 8:03
  • du -sb --apparent-size filename returns exactly the same number as Windows's Properties Dialog's "Size (... bytes)". – Josiah Yoder Sep 5 '18 at 15:34

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.