![]() |
|
|
|
|
|||||||
| Forums | Portal | Register | Forum 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 !! |
|
|
Submit Tools | LinkBack | Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
Hi everyone:
I was wondering if anyone can tell me why the size of a file listed using "du" and "ls -l" is different. Thanks in advance.. |
| Forum Sponsor | ||
|
|
|
#2
|
||||
|
||||
|
An 'ls -l' will show the size of the file in bytes. 'du' shows the size of the file in 512-byte units, rounded up to the next 512-byte unit.
Cheers, Keith |
|
#3
|
|||
|
|||
|
Can anyone think of a scenario in which size reported by ls -l is less than the size reported by du.
The other way round is possible, if the file has holes, ls -l will report a size more than du (since du calculates the actual disk usage) But I cannot understand why du reports a size more than ls -l. For e.g: % ls -l file12MB.pdf -rw-r--r-- 1 vqwe 11650342 Apr 19 16:34 file12MB.pdf % du -k file12MB.pdf 11404 file12MB.pdf du shows file size is 11404 Kb. ls shows file size is 11650342 bytes = 11377.2 Kb How is this possible ? Is it that du counts the space occupied by Indirect blocks as well ??? awaiting your response |
|
#4
|
||||
|
||||
|
Quote:
Btw, your second case is often called "sparse files". |
||||
| Google The UNIX and Linux Forums |