The command
du -b /home/user/directory
shows a completely different file size than displayed by a manual "right click" on the same directory and selecting "Properties" inside common file browsers like Nautilus, PCManFM, Windows Explorer or others.
Examples for requesting the file size:
- Via file browser: "Right click" ⇨ "Properties" on a directory shows an apparent (real) file size of 8.141.120 bytes. On the other hand, the used disk space has 8.155.136 bytes and is a bit higher (because of fragmenting etc.).
- Via
du -b
: Shows an inexplicable size of 8.145.216 bytes (which is neither the apparent size nor the used disk space of the previous method with file browser).
I already know that the du
-command will display the used disk space instead of the apparent size of the directory. With du -b
one can change that default behavior to display the apparent (real) size instead. Nevertheless, in "Properties", both the real size as well as the used disk space are completely different from the mentioned output of du -b
.
What is the reason for that? Which CLI-command do I have to use if I want to show the real (apparent) file or directory size which has exactly the same value like displayed in file browsers via "Right click" ⇨ "Properties"?
I ask for that because I want to create some simple bash script to compare the real sizes of content on HDD1 and HDD2 after performing a backup. This should be compared within a high possible bit accuracy. A comparison of the used disk spaces won't make sense in that case, because they are very different on both drives.
ls
in a terminal and I'm right-click on a directory I don't get any information about size. :) Please don't assume people reading your question can look over your shoulder to understand what you're doing. – Satō Katsura Sep 28 '17 at 05:20du
orls
to get the same (!) value like displayed in file browsers file properties... – Dave Sep 28 '17 at 05:36du -b
and via common file browsers. I don't understand the reason about those differences and want to unify that behaviour to an equal system. – Dave Sep 28 '17 at 06:57