Is it possible to get ls to show file size, not allocated size?
By Michael Henderson •
When downloading a large file, there is a big discrepancy beween the actual file size (which I care about) and the allocated (ie, final) size (which I usually don't.)
$ ls -lshk
9962420 -rw-r--r-- 1 stevebennett staff 19G 16 Jan 14:30 parcelsclip.zip_.gstmpIn this case, the file will be 19GB eventually, but right now, it's only 9.96GB, as indicated by the first column.
Is there a way to have that 19G column show the current size (9962420), but in human-friendly terms (10GB)?
61 Answer
Use du -h filename instead of ls.
"du" stands for "disk usage", and although usually used for directories, it also reports for single files the amount of disk space they actually occupy.
-h makes it report human readable numbers, e.g. "10.0G".