<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META content="text/html; charset=utf-8" http-equiv=Content-Type>
<STYLE>
BLOCKQUOTE {
        MARGIN-TOP: 0px; MARGIN-BOTTOM: 0px; MARGIN-LEFT: 2em
}
OL {
        MARGIN-TOP: 0px; MARGIN-BOTTOM: 0px
}
UL {
        MARGIN-TOP: 0px; MARGIN-BOTTOM: 0px
}
P {
        MARGIN-TOP: 0px; MARGIN-BOTTOM: 0px
}
BODY {
        LINE-HEIGHT: 1.5; FONT-FAMILY: Î¢ÈíÑźÚ; COLOR: #000000; FONT-SIZE: 10.5pt
}
</STYLE>

<META name=GENERATOR content="MSHTML 8.00.7600.17267"></HEAD>
<BODY style="MARGIN: 10px">
<DIV>Hi,</DIV>
<DIV>&nbsp;</DIV>
<DIV style="TEXT-INDENT: 2em">My confusion is:</DIV>
<DIV style="TEXT-INDENT: 4em">In the pdf, it is said&nbsp;-k(-h) modifies 
-s.</DIV>
<DIV style="TEXT-INDENT: 4em">But,&nbsp;-k(-h) is used to show the "st_size 
column", while -s is used to show the "st_blocks&nbsp; column". So -k(-h) does 
not modifies -s, which is in conflict with what the ls.pdf said.</DIV>
<DIV>&nbsp;</DIV>
<HR style="WIDTH: 210px; HEIGHT: 1px" align=left color=#b5c4df SIZE=1>

<DIV><SPAN>
<DIV style="FONT-FAMILY: verdana; FONT-SIZE: 10pt">
<DIV>
<DIV>
<DIV>
<DIV>Sincerely,</DIV>
<DIV>Xiang Xu (徐祥) </DIV>
<DIV>Student ID: 10388813</DIV>
<DIV>tel: +1 (201) 918-0570</DIV>
<DIV>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; +86 13851478402</DIV>
<DIV>qq: 185904095</DIV></DIV></DIV></DIV></DIV></SPAN></DIV>
<DIV>&nbsp;</DIV>
<DIV 
style="BORDER-BOTTOM: medium none; BORDER-LEFT: medium none; PADDING-BOTTOM: 0cm; PADDING-LEFT: 0cm; PADDING-RIGHT: 0cm; BORDER-TOP: #b5c4df 1pt solid; BORDER-RIGHT: medium none; PADDING-TOP: 3pt">
<DIV 
style="PADDING-BOTTOM: 8px; PADDING-LEFT: 8px; PADDING-RIGHT: 8px; FONT-FAMILY: tahoma; BACKGROUND: #efefef; COLOR: #000000; FONT-SIZE: 12px; PADDING-TOP: 8px">
<DIV><B>From:</B>&nbsp;<A href="mailto:sshah83@stevens.edu">sshah83</A></DIV>
<DIV><B>Date:</B>&nbsp;2014-10-17&nbsp;10:57</DIV>
<DIV><B>To:</B>&nbsp;<A 
href="mailto:cs631apue@lists.stevens.edu">cs631apue</A></DIV>
<DIV><B>Subject:</B>&nbsp;Re: [cs631apue] blocks (-s) &amp; size (-k 
-h)</DIV></DIV></DIV>
<DIV>
<DIV>Linux ls -s displays the number of blocks allocated to each file in unit 
</DIV>
<DIV>of 1024 bytes or BLOCKSIZE environment variable (if it's set). for </DIV>
<DIV>example</DIV>
<DIV>&nbsp;</DIV>
<DIV>1) ls -s (if no BLOCKSIZE env variable is set)</DIV>
<DIV>&nbsp; - file_blk_size&nbsp; = (st_blocks*512)/1024.0</DIV>
<DIV>&nbsp;</DIV>
<DIV>&nbsp;</DIV>
<DIV>2) export BLOCKSIZE = 200</DIV>
<DIV>ls -s</DIV>
<DIV>&nbsp; - file_blk_size = (st_blocks*512)/env_blksize</DIV>
<DIV>&nbsp;</DIV>
<DIV>in both above cases if file_blk_size comes in decimal, you have to round 
</DIV>
<DIV>that partial unit to next integer value.</DIV>
<DIV>&nbsp;</DIV>
<DIV>&nbsp;</DIV>
<DIV>Now if -k or -h is combined with ls -s, it does not use env BLOCKSIZE 
</DIV>
<DIV>variable to calculate the number of blocks of</DIV>
<DIV>each file and modifies ls -s output. For example</DIV>
<DIV>&nbsp;</DIV>
<DIV>export BLOCKSIZE = 200</DIV>
<DIV>&nbsp;</DIV>
<DIV>ls -sk</DIV>
<DIV>- file_blk_size =&nbsp; (st_blocks*512)/1024.0</DIV>
<DIV>&nbsp;</DIV>
<DIV>even if the evn BLOCKSIZE is 200, it's ignored if -k is combined with ls 
</DIV>
<DIV>-s.</DIV>
<DIV>&nbsp;</DIV>
<DIV>&nbsp;</DIV>
<DIV>On 10/17/2014 12:50 AM, xxu15@stevens.edu wrote:</DIV>
<DIV>&gt; </DIV>
<DIV>&gt; Hi,</DIV>
<DIV>&gt; -k or -h is to show the file size, they override each other.</DIV>
<DIV>&gt; </DIV>
<DIV>&gt; -s is to show the total number of blocks, which is a separate 
column.</DIV>
<DIV>&gt; So, I DON'T UNDERSTAND, IN LS.PDF, WHAT'S THE MEANING OF "-K / 
-H</DIV>
<DIV>&gt; MODIFIES THE -S OPTION".&nbsp;&nbsp;&nbsp;</DIV>
<DIV>&gt; </DIV>
<DIV>&gt; -------------------------</DIV>
<DIV>&gt; </DIV>
<DIV>&gt; Sincerely,</DIV>
<DIV>&gt; Xiang Xu (徐祥)</DIV>
<DIV>&gt; Student ID: 10388813</DIV>
<DIV>&gt; tel: +1 (201) 918-0570</DIV>
<DIV>&gt;&nbsp; +86 13851478402</DIV>
<DIV>&gt; qq: 185904095</DIV>
<DIV>&gt; _______________________________________________</DIV>
<DIV>&gt; cs631apue mailing list</DIV>
<DIV>&gt; cs631apue@lists.stevens.edu</DIV>
<DIV>&gt; https://lists.stevens.edu/mailman/listinfo/cs631apue</DIV>
<DIV>_______________________________________________</DIV>
<DIV>cs631apue mailing list</DIV>
<DIV>cs631apue@lists.stevens.edu</DIV>
<DIV>https://lists.stevens.edu/mailman/listinfo/cs631apue</DIV></DIV></BODY></HTML>