Du-sh filename (In fact, we often use du-sh * to display all the files and their sizes in the current directory, if you want to sort them and add them later | SORT-N)about the right-click property and the Du-sh display of the file size inconsistency:In short: I understand that du found the actual hard disk block size, including a lot of hidden files, soft, hard links, as well as due to disk format, such as problems, resulting in inconsistencies, right-click Properties equivalent todu--exclude= '. * '--exclude= ' *~ '-b-d-S your file or folder and the extra stuff. and Du-sh was all displayed, so he showed it to be big. (Baidu to, I think reasonable) there are several aspects of the problem, resulting in several methods of calculating file size.
1. The size of the content and the size of the disk (or any other storage device), such as
# file content is three letters plus a line break
~/tmp$ Cat Abc.txt
Efg
# content size is 4 bytes (--apparent-size compute content size,--block-size=1 in byte bit units)
~/tmp$ du--apparent-size--block-size=1 abc.txt
4 Abc.txt
# takes up 4096 bytes of disk space, and this result is closely related to disk format
~/tmp$ du--block-size=1 abc.txt
4096 Abc.txt
2. Issues with symbolic links (symbolic links or soft links or symlinks)
# Here's a symbolic link to the file just now
~/tmp$ LS-NL Link_abc.txt
lrwxrwxrwx 1 7 Jan 18:34 link_abc.txt-Abc.txt
# The symbolic link itself does not occupy "normal" disk space, just like an empty file.
~/tmp$ du--block-size=1 link_abc.txt
0 Link_abc.txt
# But the content size is still there, actually "abc.txt" a total of 7 characters.
~/tmp$ du--apparent-size--block-size=1 link_abc.txt
7 Link_abc.txt
~/tmp$
# In addition, to see the size of the file pointed to, it should be like this (as in the beginning)
~/tmp$ du--apparent-size--block-size=1-l link_abc.txt
4 Link_abc.txt
3. Problems with hidden files
English period "." Files that begin with a file or the tilde "~" are hidden files.
~/tmp$ ls
Abc.txt Link_abc.txt
~/tmp$ ls-a
Abc.txt link_abc.txt. xxx
(However, it seems that "*~" is not a hidden file for the LS command.)
4. The folder itself occupies a space problem
# du is to count the size of the folder itself
~/tmp$ du--exclude= '. * '--exclude= ' *~ '--apparent-size-s-b-d ~/tmp
4107/home/xyy/tmp
# System File Management not counted (right-click property) Gnome default File Manager Nautilus the file size when ignoring hidden files (corresponding to Du--exclude= '. * '--exclude= ' *~ '), which will follow a layer of symbolic links (corresponding to du-d), showing the file content size (not disk occupancy) , and takes 1000 (du-b).
and finally , together,
du--exclude= '. * '--exclude= ' *~ '-b-d-S your file or folder
Resolution on the inconsistency between the right-key property and the file size displayed by the Du-sh