![]() |
|
|
|
|
|||||||
| Forums | Portal | Register | Rules & FAQ | Contribute | Members List | Arcade | Search | Today's Posts | Mark Forums Read |
| UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !! |
|
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Directory sizes loop optimization | la_womn | Shell Programming and Scripting | 6 | 05-16-2008 08:05 PM |
| to compare total directory structure and get sizes of all f on two different servers | mannam srinivas | Shell Programming and Scripting | 3 | 04-07-2008 01:21 AM |
| Script for checking and reporting file sizes in a directory. | marconi | Shell Programming and Scripting | 1 | 04-03-2008 05:00 AM |
| PERL: How do I get both sizes of a matrix? | foo.bar | Shell Programming and Scripting | 2 | 09-26-2007 02:25 PM |
| compare file sizes | joli | Shell Programming and Scripting | 4 | 02-04-2005 02:52 PM |
|
|
LinkBack | Thread Tools | Display Modes |
|
|||
|
Directory sizes
Can someone tell me how to read these damn sizes.
i mean, i prefer to see sizes in MB but that is not the case when you do an ls -l on directories. i have a had time converting these to MB just for verification purposes, what would a directory size like this = 3499990308 represent in MB or something like this 29994?? or is there a rule i can follow to be able to calculate this crap on my own? honestly, if any revision needs to be made to unix, it should be the ability to make all these sizes VERY easy to read. unix is complicated enough to be wasting time on this nonsense |
| Forum Sponsor | ||
|
|
|
||||
|
........
by the way:
the "-h" is also useable for this output: root@pressy.ips.at # df -h /dev/dsk/c0t0d0s0 Filesystem size used avail capacity Mounted on /dev/dsk/c0t0d0s0 2.0G 2.0G 0K 100% / greetings Preßy |
|
||||
|
Preßy,
ls -h is available only on GNU ls. So that is not a very general answer. Besides, the real thrust of the question is the mental conversion of bytes to megabytes. 3499990308 as displayed by ls represents bytes. To get it to megabytes, I want to drop the last 6 digits. 3499990308 is sort of how I "see" the number. Now I do evaluate that 990308 as I throw it away. I do that really by looking just at the leading nine. Since I am throwing away a "large" number, I add one to the number that I keep. 3499 + 1 = 3500 MB. Whether or not to add that one depends on the leading digit of what I threw away. If it's 5,6,7,8, or 9 then I add the one. This is a compromise, I would use a more accurate algorithm if I were writing a program. But I can do this instantly and effortlessly. Effectively, what I have done is to divide the number by 1,000,000. Perfect accuracy would have required dividing by 1,048,576. Using the bc program I see that the real answer is 3338 MB. With a file this big, I don't care about a lousy 162 MB. 29994 is too small. Well, ok, it is 0 MB. I simply never want to convert tiny sizes to megabytes. But kilobytes would work in this case. The rule is similiar to the above, but here I just drop 3 digits rather than 6. So I estimate that file at 30 KB. bc says the real answer is 29 KB. Again, close enough. Notice that both of my estimates were high. That is guaranteed to be the case. |
||||
| Google UNIX.COM |