[cs631apue] ls -s

Tyler Romeo tromeo at stevens.edu
Mon Oct 19 05:07:34 EDT 2015


As Julian mentioned previously, the default of ls(1) is to display blocks of 1 KiB, whereas stat(2) always returns 512 B blocks. This accounts for the difference you are seeing.

-- 
Tyler Romeo
Stevens Institute of Technology Class of 2016
Major in Computer Science

From: 曹勇 <ycao18 at stevens.edu>
Reply: 曹勇 <ycao18 at stevens.edu>
Date: October 19, 2015 at 00:25:53
To: cs631apue at lists.stevens.edu <cs631apue at lists.stevens.edu>
Subject:  [cs631apue] ls -s  

When I execute ls -s on LINUX-Lab, the blocks value seems incorrect.  
stat command shows blocks should be 37, but ls -s print 19.  
What is wrong?  


@smurf:~/631/midterm$ stat ls.c  
File: `ls.c'  
Size: 18218 Blocks: 37 IO Block: 32768 regular file  
Device: 1ch/28d	Inode: 12443 Links: 1  
Access: (0644/-rw-r--r--) Uid: (12462/ ycao18) Gid: (30000/ student)  
Access: 2015-10-19 00:16:19.210720356 -0400  
Modify: 2015-10-19 00:16:12.217196323 -0400  
Change: 2015-10-19 00:16:12.217204089 -0400  
Birth: -  
@smurf:~/631/midterm$ ls -s ls.c  
19 ls.c  
@smurf:~/631/midterm$  
_______________________________________________  
cs631apue mailing list  
cs631apue at lists.stevens.edu  
https://lists.stevens.edu/mailman/listinfo/cs631apue  
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.stevens.edu/pipermail/cs631apue/attachments/20151019/e90c858e/attachment.html>


More information about the cs631apue mailing list