Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!mnetor!uunet!husc6!rutgers!mcnc!ece-csc!ncrcae!ncr-sd!hp-sdd!ucsdhub!esosun!cogen!alen From: alen@cogen.UUCP (Alen Shapiro) Newsgroups: comp.unix.questions Subject: Re: Can't ls -l add file sizes properly?? Message-ID: <390@cogen.UUCP> Date: Thu, 19-Nov-87 13:53:15 EST Article-I.D.: cogen.390 Posted: Thu Nov 19 13:53:15 1987 Date-Received: Sun, 22-Nov-87 14:57:34 EST References: <456@morgoth.UUCP> Reply-To: alen@cogen.UUCP (Alen Shapiro) Organization: Cogensys, LaJolla, Calf. Lines: 44 In article <456@morgoth.UUCP> glidden@morgoth.UUCP (Ken A. Glidden) writes: ># ls -l >total 40 >-rwxr--r-- 1 glidden 2117 Aug 6 12:17 acctrpt >-rwxr--r-- 1 glidden 179 Mar 2 1987 age.csh >-rwxrwxr-- 1 root 1308 Aug 4 16:39 arcjobs.sh >-rwxr-x--- 1 glidden 29696 Mar 2 1987 deltime >-rwxr--r-- 1 glidden 269 Sep 9 1986 mailbarry >-r-xr--r-- 1 glidden 296 Aug 25 1986 mailjim >-rwxr--r-- 1 glidden 728 Jan 7 1987 newsindex >-rw-r--r-- 1 root 1132 Aug 4 14:11 tmp > ====== >SUBTOTAL------> 35,725 > >**** >Why does the ls -l "total" give me 40Kb and my manual addition of the file >sizes give me 35.7Kb !?!?!?! (Note: This came from Ultrix 2.0 on a DEC uVAX II) >**** Try this for size (excuse the pun please). Our version of ls thinks it knows that we have a minimum disk block size of 1k (the 1024 byte variety). The number of 'k' that ls reports is the number of disk blocks used. Since only 1 in 1024 files will fully populate disk blocks (except if they are compiled images (darn there goes a perfectly reasonable generalisation)) Hence a discrepancy between the number of bytes used and the number of 1k blocks used. Try ls -ls (following) to see the effect. total 40 3 -rwxr--r-- 1 glidden 2117 Aug 6 12:17 acctrpt 1 -rwxr--r-- 1 glidden 179 Mar 2 1987 age.csh 2 -rwxrwxr-- 1 root 1308 Aug 4 16:39 arcjobs.sh 29 -rwxr-x--- 1 glidden 29696 Mar 2 1987 deltime 1 -rwxr--r-- 1 glidden 269 Sep 9 1986 mailbarry 1 -r-xr--r-- 1 glidden 296 Aug 25 1986 mailjim 1 -rwxr--r-- 1 glidden 728 Jan 7 1987 newsindex 2 -rw-r--r-- 1 root 1132 Aug 4 14:11 tmp == ====== 40 35,725 --alen the Lisa slayer (it's a long story) ps du's approach to the same problem is yet another story. It lives in an age long gone (512 byte blocks & expensive disks)