This question already has an answer here:
- `du -b` shows different size than `ls` 2 answers
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.).
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
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.