Linux Help
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsOperating SystemsLinux Help

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
1200+ fellow developers rate and compare features of the top IDEs, like Visual Studio, Eclipse, RAD, Delphi and others, across 13 categories. Enjoy this FREE Download of the IDE User Satisfaction Study by Evans Data Corporation. Download Now!
  #1  
Old August 23rd, 2002, 03:36 PM
jwalk76 jwalk76 is offline
Huge Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: May 2002
Posts: 141 jwalk76 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 6 m 3 sec
Reputation Power: 7
"du" and "ls" generating inconsistent file sizes

i've written a couple of shell scripts that pipe "du -b" and "ls -l -R" to a couple of awk programs. the output of each program is the total number and filesize of all of the images in a client's on-line photo gallery. just to be sure that each program is returning the same list i've output the list to the screen. both programs return the same files but with varying file size results. if i look back through each programs list of images i'll notice for instance:

du says pic13.jpg is 40960 bytes

ls says pic13.jpg is 40146 bytes

so, which result should i trust more, du or ls?

Reply With Quote
  #2  
Old August 29th, 2002, 11:24 PM
ethand ethand is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Aug 2002
Posts: 3 ethand User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
du gives you the size of the file as it resides on the file system. ( IE will will always give you a result that is divisible by 1024 ).

ls will give you the actual size of the file.

What you are looking at is the difference between the actual size of the file and the amount of space on disk it takes. ( also called file system efficiency ).

Reply With Quote
  #3  
Old August 31st, 2002, 12:29 PM
jwalk76 jwalk76 is offline
Huge Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: May 2002
Posts: 141 jwalk76 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 6 m 3 sec
Reputation Power: 7
thanks, i appreciate the response.

Reply With Quote
Reply

Viewing: Dev Shed ForumsOperating SystemsLinux Help > "du" and "ls" generating inconsistent file sizes


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 5 hosted by Hostway