LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 10-17-2014, 09:05 PM   #1
splintercdo
Member
 
Registered: Feb 2011
Posts: 141

Rep: Reputation: 11
File/Directory size


And which one do I trust?
Attached Thumbnails
Click image for larger version

Name:	funny.png
Views:	59
Size:	133.3 KB
ID:	16677  
 
Old 10-17-2014, 09:28 PM   #2
splintercdo
Member
 
Registered: Feb 2011
Posts: 141

Original Poster
Rep: Reputation: 11
Ah, OK, I got 979453 in du, it's the size of subdirs. 983549 was including current directory.

But it still is strange why Nautilus shows 971.3kB
 
Old 10-17-2014, 09:30 PM   #3
jlinkels
LQ Guru
 
Registered: Oct 2003
Location: Bonaire, Leeuwarden
Distribution: Debian /Jessie/Stretch/Sid, Linux Mint DE
Posts: 5,195

Rep: Reputation: 1043Reputation: 1043Reputation: 1043Reputation: 1043Reputation: 1043Reputation: 1043Reputation: 1043Reputation: 1043
Either one.

Nautilus gives total size in bytes and correctly calculated the kibibytes.

dh gives the correct amount plus 4069 bytes for the '.' entry. Which is the current directory. The directory (literally a directory) is 4096 bytes.

jlinkels
 
Old 10-17-2014, 10:17 PM   #4
splintercdo
Member
 
Registered: Feb 2011
Posts: 141

Original Poster
Rep: Reputation: 11
Does not seem to be so.

* Nautilus gives larger number. So, if anything is including something, it's Nautilus.
* The difference is huge.
- 971.3K - 956.5K = 14.8K
* And, if I play around then, all subdirs 56 * 4096B / 1024 = 224K

Last edited by splintercdo; 10-17-2014 at 10:19 PM.
 
Old 10-18-2014, 06:29 AM   #5
jlinkels
LQ Guru
 
Registered: Oct 2003
Location: Bonaire, Leeuwarden
Distribution: Debian /Jessie/Stretch/Sid, Linux Mint DE
Posts: 5,195

Rep: Reputation: 1043Reputation: 1043Reputation: 1043Reputation: 1043Reputation: 1043Reputation: 1043Reputation: 1043Reputation: 1043
Krusader calculates KIBIbytes and Nautilus calculates KILObytes. Hence the difference.

Furthermore I said ONE directory was counted extra in du, not ALL subdirectories.

jlinkels
 
1 members found this post helpful.
Old 10-18-2014, 07:01 AM   #6
splintercdo
Member
 
Registered: Feb 2011
Posts: 141

Original Poster
Rep: Reputation: 11
Oh wow! I didn't knew, there was such a thing as Kibibyte.
Thanks for clarification!
 
Old 10-20-2014, 11:13 AM   #7
replica9000
Senior Member
 
Registered: Jul 2006
Distribution: Debian Unstable
Posts: 1,126
Blog Entries: 2

Rep: Reputation: 260Reputation: 260Reputation: 260
Quote:
Originally Posted by splintercdo View Post
Oh wow! I didn't knew, there was such a thing as Kibibyte.
Thanks for clarification!
I believe at one time, a kilobyte was actually considered 1024 bytes. But due to false/simplified advertising of storage media using 1000 instead of 1024, it was causing confusion. So someone suggested using kibi(KiB), mebi(MiB), gibi(GiB), etc. in place of kilo(KB), mega(MB), giga(GB), etc. to show usage of 1024. I myself have always used measurements of 1024 when it comes to the original prefixes.
 
Old 10-20-2014, 03:22 PM   #8
rknichols
Senior Member
 
Registered: Aug 2009
Distribution: Rocky Linux
Posts: 4,779

Rep: Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212
Quote:
Originally Posted by replica9000 View Post
I believe at one time, a kilobyte was actually considered 1024 bytes. But due to false/simplified advertising of storage media using 1000 instead of 1024, it was causing confusion. So someone suggested using kibi(KiB), mebi(MiB), gibi(GiB), etc. in place of kilo(KB), mega(MB), giga(GB), etc. to show usage of 1024. I myself have always used measurements of 1024 when it comes to the original prefixes.
Do you use that for "kilometers" too? How about a "1 Kilohertz" tone?

The prefix "kilo" had a well defined meaning of "1000" since before computers and memory devices started using it. Then memory chips, built with capacities that are always a power of 2, came along, and "1024" was close enough to "1000" that nobody really cared much about the difference (just 2.4%). But as sizes got larger and larger, additional powers of 1.024 increased the divergence. By the time you get to terabytes (vs. tibibytes) it's a nearly 10% difference, and people are grumbling that their disk drives are smaller than what they thought was advertised.

For anything other than memory chips, there is little reason for the long-established prefixes to be taken as anything other than powers of 10. A kilometer is 1000 meters, "the tone at the time is 1000 cycles" (old joke -- more likely 400 or 440Hz, actually), a 56Kb/s link carries 56,000 bits/second, and a "1 terabyte" disk drive holds 1,000,000,000,000 bytes.
 
Old 10-20-2014, 04:30 PM   #9
replica9000
Senior Member
 
Registered: Jul 2006
Distribution: Debian Unstable
Posts: 1,126
Blog Entries: 2

Rep: Reputation: 260Reputation: 260Reputation: 260
Quote:
Originally Posted by rknichols View Post
Do you use that for "kilometers" too? How about a "1 Kilohertz" tone?

The prefix "kilo" had a well defined meaning of "1000" since before computers and memory devices started using it. Then memory chips, built with capacities that are always a power of 2, came along, and "1024" was close enough to "1000" that nobody really cared much about the difference (just 2.4%). But as sizes got larger and larger, additional powers of 1.024 increased the divergence. By the time you get to terabytes (vs. tibibytes) it's a nearly 10% difference, and people are grumbling that their disk drives are smaller than what they thought was advertised.

For anything other than memory chips, there is little reason for the long-established prefixes to be taken as anything other than powers of 10. A kilometer is 1000 meters, "the tone at the time is 1000 cycles" (old joke -- more likely 400 or 440Hz, actually), a 56Kb/s link carries 56,000 bits/second, and a "1 terabyte" disk drive holds 1,000,000,000,000 bytes.
This backs up what I was saying.
http://en.m.wikipedia.org/wiki/Kibibyte

I know that outside of the computer world, kilo always = 1000
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] Store the size of largest file from a file/directory listing into variable SIZE lainey Linux - Newbie 3 11-15-2011 12:29 PM
How to write crontab to check file size and all file in a directory? modpriest Linux - Newbie 1 02-14-2008 06:48 AM
Script to delete files with 0k file size in a directory justgiver Linux - Newbie 4 01-28-2008 04:56 AM
Directory file size script yeahflow Linux - Newbie 4 09-03-2006 07:29 PM
How to list total file size of a directory phil1076 Linux - General 3 12-18-2003 03:47 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 10:50 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration