I have a folder containing .tcb and .tch files. I need to know what the size of all .tcb files together, respectively of all .tch files is. I did like this:
1) I created a temp folder and then:
mv *tch temp
2) and then:
du -sk temp
I found the command in the Internet and wikipedia says this: "du (abbreviated from disk usage) is a standard Unix program used to estimate the file space usage". I think the reason why it says that it is an estimation is that if there are links then the size of the link will be shown instead of the linked file.
But if I do
ls -l
in the temp folder (which contains the all *.tch) files and then sum up the sizes which are displayed in the terminal, I have another file size. Why is that the case?
Well in sum, what I need is a command which shows me the real file size of *all .tch files in a folder, which can contain also other file types.
I hope anyone can help me with that. Thanks a lot!
You can use the -L
option to du
if you want to follow symbolic links (that is, calculate the size of the link target, not of the link itself). You can also use the -c
option to display a grand total at the end.
Armed with those options, try du -skLc *.tch
.
For more details on du
, see this manpage.