{"id":1375,"date":"2017-08-02T16:02:19","date_gmt":"2017-08-02T08:02:19","guid":{"rendered":"http:\/\/ykyi.net\/?p=1375"},"modified":"2017-08-02T16:02:19","modified_gmt":"2017-08-02T08:02:19","slug":"%e5%8f%91%e7%8e%b0linux%e5%91%bd%e4%bb%a4%e5%b7%a5%e5%85%b7find%e7%9a%84%e4%b8%80%e4%b8%aabug","status":"publish","type":"post","link":"https:\/\/ykyi.net\/?p=1375","title":{"rendered":"\u53d1\u73b0linux\u547d\u4ee4\/\u5de5\u5177find\u7684\u4e00\u4e2a&#8221;bug&#8221;"},"content":{"rendered":"<p>\u4eca\u5929\u7528find\u547d\u4ee4\u627e\u4e00\u4e2a\u76ee\u5f55\u4e0b\u9762\u6240\u6709\u5927\u5c0f\u5c0f\u4e8e1K\u7684\u666e\u901a\u6587\u4ef6. \u6211\u7684\u547d\u4ee4\u662f\u8fd9\u4e48\u5199\u7684\uff1a<\/p>\n<pre><code>$ find ~ -type f -a -size -1K | wc -l\n<\/code><\/pre>\n<p>\u53d1\u73b0\u5f97\u5230\u7684\u6570\u5b57\u660e\u663e\u6bd4\u9884\u60f3\u7684\u5c0f\u5f88\u591a\u3002\u4f46\u547d\u4ee4\u6ca1\u9519\u5440~~\u767e\u601d\u4e0d\u5f97\u5176\u89e3\u4e4b\u4e0b\uff0c\u53c8\u8bd5\u4e86\u4e00\u4e0b\u53e6\u4e00\u79cd\u5199\u6cd5\u3002\u8fd9\u65f6\uff0c\u5c31\u6b63\u5e38\u4e86\uff0c\u771f\u5947\u602a\u554a~~<\/p>\n<pre><code>$ find ~ -type f -a -size -1024c | wc -l\n<\/code><\/pre>\n<p>\u8fd9\u6b21\u5c31\u6b63\u5e38\u4e86\uff01\uff01\uff01<br \/>\n\u6211\u53cd\u590d\u67e5\u6587\u6863\uff1a<\/p>\n<blockquote><p>\n  c for bytes<br \/>\n  K for Kilobytes  (units of 1024 bytes)\n<\/p><\/blockquote>\n<p>\u5bf9\u554a~~\u6ca1\u9519\u554a\u3002 1K\u5c31\u662f1024byte\u3002\u54ea\u91cc\u51fa\u95ee\u9898\u4e86\uff0c\u54ea\u51fa\u51fa\u9519\u4e86\u5462\uff1f\u96be\u9053\u662flinux\u7684bug\u5417\uff1f\u6211\u6362\u4e86\u4e00\u4e2a\u53d1\u884c\u7248\u7684linux\uff0c\u53d1\u73b0\u8fd8\u662f\u540c\u6837\u7684\u60c5\u51b5\u3002\u8fd9\u5c31\u90c1\u95f7\u4e86~~<br \/>\n\u518d\u6b21\u67e5\u770b\u6587\u6863\uff0c\u8fd9\u6b21\u8be6\u7ec6\u8bfb\u6587\u6863\u4e86\uff01\u7ec8\u4e8e\u53d1\u73b0\u95ee\u9898\u6240\u5728\u4e86\uff1a<\/p>\n<blockquote><p>\n  The  +  and  &#8211; prefixes signify greater than and less than, as usual.  Bear in mind that the size is rounded up to the next<br \/>\n  unit. Therefore -size -1M is not equivalent to -size -1048576c.  The former only matches empty files,  the  latter  matches<br \/>\n  files from 1 to 1,048,575 bytes.\n<\/p><\/blockquote>\n<p>\u81f3\u6b64\uff0c\u771f\u76f8\u5927\u767d\uff01~~\u539f\u6765\u5462<br \/>\n<strong>\u7528K\u6216M\u8fd9\u4e9b\u5355\u4f4d\u65f6\uff0c\u5c3a\u5bf8\u4f1a\u88ab\u5411\u4e0a\u53d6\u6574(is rounded up to the next unit)\u3002\u8fd9\u6837\u4e00\u4e2a100\u5b57\u8282\u7684\u6587\u4ef6\u88ab\u5411\u4e0a\u53d6\u6574\u52301K\u7684\u6587\u4ef6\uff0c\u5c31\u6ca1\u6709\u547d\u4e2d-1K\u4e86<\/strong><br \/>\n\u8fd9\u91cc\u975e\u5e38\u5947\u602a\u7684\u662f\u201c\u5411\u4e0a\u53d6\u6574\u201d\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u4eca\u5929\u7528find\u547d\u4ee4\u627e\u4e00\u4e2a\u76ee\u5f55\u4e0b\u9762\u6240\u6709\u5927\u5c0f\u5c0f\u4e8e1K\u7684\u666e\u901a\u6587\u4ef6. \u6211\u7684\u547d\u4ee4\u662f\u8fd9\u4e48\u5199\u7684\uff1a $ find ~ -type f -a -size -1K | wc -l \u53d1\u73b0\u5f97\u5230\u7684\u6570\u5b57\u660e\u663e\u6bd4\u9884\u60f3\u7684\u5c0f\u5f88\u591a\u3002\u4f46\u547d\u4ee4\u6ca1\u9519\u5440~~\u767e\u601d\u4e0d\u5f97\u5176\u89e3\u4e4b\u4e0b\uff0c\u53c8\u8bd5\u4e86\u4e00\u4e0b\u53e6\u4e00\u79cd\u5199\u6cd5\u3002\u8fd9\u65f6\uff0c\u5c31\u6b63\u5e38\u4e86\uff0c\u771f\u5947\u602a\u554a~~ $ find ~ -type f -a -size -1024c | wc -l \u8fd9\u6b21\u5c31\u6b63\u5e38\u4e86\uff01\uff01\uff01 \u6211\u53cd\u590d\u67e5\u6587\u6863\uff1a c for bytes K for Kilobytes (units of 1024 bytes) \u5bf9\u554a~~\u6ca1\u9519\u554a\u3002 1K\u5c31\u662f1024byte\u3002\u54ea\u91cc\u51fa\u95ee\u9898\u4e86\uff0c\u54ea\u51fa\u51fa\u9519\u4e86\u5462\uff1f\u96be\u9053\u662flinux\u7684bug\u5417\uff1f\u6211\u6362\u4e86\u4e00\u4e2a\u53d1\u884c\u7248\u7684linux\uff0c\u53d1\u73b0\u8fd8\u662f\u540c\u6837\u7684\u60c5\u51b5\u3002\u8fd9\u5c31\u90c1\u95f7\u4e86~~ \u518d\u6b21\u67e5\u770b\u6587\u6863\uff0c\u8fd9\u6b21\u8be6\u7ec6\u8bfb\u6587\u6863\u4e86\uff01\u7ec8\u4e8e\u53d1\u73b0\u95ee\u9898\u6240\u5728\u4e86\uff1a The + and &#8211; prefixes signify greater than and less than, as usual. Bear in &hellip; <a href=\"https:\/\/ykyi.net\/?p=1375\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;\u53d1\u73b0linux\u547d\u4ee4\/\u5de5\u5177find\u7684\u4e00\u4e2a&#8221;bug&#8221;&#8221;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[6],"tags":[],"class_list":["post-1375","post","type-post","status-publish","format-standard","hentry","category-tech_articles"],"_links":{"self":[{"href":"https:\/\/ykyi.net\/index.php?rest_route=\/wp\/v2\/posts\/1375","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/ykyi.net\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/ykyi.net\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/ykyi.net\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/ykyi.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1375"}],"version-history":[{"count":0,"href":"https:\/\/ykyi.net\/index.php?rest_route=\/wp\/v2\/posts\/1375\/revisions"}],"wp:attachment":[{"href":"https:\/\/ykyi.net\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1375"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/ykyi.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1375"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/ykyi.net\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1375"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}