<!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> </DIV>
<DIV style="TEXT-INDENT: 2em">My confusion is:</DIV>
<DIV style="TEXT-INDENT: 4em">In the pdf, it is said -k(-h) modifies
-s.</DIV>
<DIV style="TEXT-INDENT: 4em">But, -k(-h) is used to show the "st_size
column", while -s is used to show the "st_blocks column". So -k(-h) does
not modifies -s, which is in conflict with what the ls.pdf said.</DIV>
<DIV> </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> +86 13851478402</DIV>
<DIV>qq: 185904095</DIV></DIV></DIV></DIV></DIV></SPAN></DIV>
<DIV> </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> <A href="mailto:sshah83@stevens.edu">sshah83</A></DIV>
<DIV><B>Date:</B> 2014-10-17 10:57</DIV>
<DIV><B>To:</B> <A
href="mailto:cs631apue@lists.stevens.edu">cs631apue</A></DIV>
<DIV><B>Subject:</B> Re: [cs631apue] blocks (-s) & 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> </DIV>
<DIV>1) ls -s (if no BLOCKSIZE env variable is set)</DIV>
<DIV> - file_blk_size = (st_blocks*512)/1024.0</DIV>
<DIV> </DIV>
<DIV> </DIV>
<DIV>2) export BLOCKSIZE = 200</DIV>
<DIV>ls -s</DIV>
<DIV> - file_blk_size = (st_blocks*512)/env_blksize</DIV>
<DIV> </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> </DIV>
<DIV> </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> </DIV>
<DIV>export BLOCKSIZE = 200</DIV>
<DIV> </DIV>
<DIV>ls -sk</DIV>
<DIV>- file_blk_size = (st_blocks*512)/1024.0</DIV>
<DIV> </DIV>
<DIV>even if the evn BLOCKSIZE is 200, it's ignored if -k is combined with ls
</DIV>
<DIV>-s.</DIV>
<DIV> </DIV>
<DIV> </DIV>
<DIV>On 10/17/2014 12:50 AM, xxu15@stevens.edu wrote:</DIV>
<DIV>> </DIV>
<DIV>> Hi,</DIV>
<DIV>> -k or -h is to show the file size, they override each other.</DIV>
<DIV>> </DIV>
<DIV>> -s is to show the total number of blocks, which is a separate
column.</DIV>
<DIV>> So, I DON'T UNDERSTAND, IN LS.PDF, WHAT'S THE MEANING OF "-K /
-H</DIV>
<DIV>> MODIFIES THE -S OPTION". </DIV>
<DIV>> </DIV>
<DIV>> -------------------------</DIV>
<DIV>> </DIV>
<DIV>> Sincerely,</DIV>
<DIV>> Xiang Xu (徐祥)</DIV>
<DIV>> Student ID: 10388813</DIV>
<DIV>> tel: +1 (201) 918-0570</DIV>
<DIV>> +86 13851478402</DIV>
<DIV>> qq: 185904095</DIV>
<DIV>> _______________________________________________</DIV>
<DIV>> cs631apue mailing list</DIV>
<DIV>> cs631apue@lists.stevens.edu</DIV>
<DIV>> 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>