分页: 1 / 1

puzzled with this output from ls

发表于 : 2011-01-24 22:48
DD_kid
ddkid@HP6515b-ddkid:~$ ls /usr/bin/* | wc
2805 2804 42724
ddkid@HP6515b-ddkid:~$ ls /usr/bin/ | wc
1402 1402 15052

so why is this?

ddkid@HP6515b-ddkid:~$ ls /bin/* | wc
125 125 1511
ddkid@HP6515b-ddkid:~$ ls /bin/ | wc
125 125 886

note the Line counter differs in first case, and doesn't in second case.

thx in advance.

really sorry for using english, just haven't installed scim yet.

Re: puzzled with this output from ls

发表于 : 2011-01-25 1:41
astolia
你仔细看看ls /usr/bin/*和ls /usr/bin/的差别就知道了。

/usr/bin/下面有个指向.的X11软链接,ls /usr/bin/*会把/usr/bin/X11下面的内容也输出一遍,所以实际的输出是
/usr/bin/下除X11以外的1401个文件

/usr/bin/X11:
/usr/bin/下的所有1402个文件
所以总共1401+1+1+1402=2805行,1401+0+1+1402=2804个词

如果你乐意,可以

代码: 全选

sudo ln -s /bin/. /bin/asoftlink
,/bin下的也会同样效果了

Re: puzzled with this output from ls

发表于 : 2011-01-25 10:09
DD_kid
非常感谢你详细的回答。
没有注意到这点 直到看到你的回复。
btw. 刚刚注意到论坛里还有云输入法 不错