{"id":3072,"date":"2018-01-27T15:12:15","date_gmt":"2018-01-27T07:12:15","guid":{"rendered":"http:\/\/cn.hostease.com\/xueyuan\/?p=3072"},"modified":"2018-01-27T15:12:15","modified_gmt":"2018-01-27T07:12:15","slug":"%e8%a7%a3%e5%86%b3linux%e7%a3%81%e7%9b%98%e6%bb%a1%e4%ba%86%e4%bb%a5%e5%8f%8a%e8%b4%9f%e8%bd%bd%e8%bf%87%e9%ab%98%e5%8a%9e%e6%b3%95","status":"publish","type":"post","link":"https:\/\/cn.hostease.com\/xueyuan\/hemanual\/%e8%a7%a3%e5%86%b3linux%e7%a3%81%e7%9b%98%e6%bb%a1%e4%ba%86%e4%bb%a5%e5%8f%8a%e8%b4%9f%e8%bd%bd%e8%bf%87%e9%ab%98%e5%8a%9e%e6%b3%95\/","title":{"rendered":"\u89e3\u51b3linux\u78c1\u76d8\u6ee1\u4e86\u4ee5\u53ca\u8d1f\u8f7d\u8fc7\u9ad8\u529e\u6cd5"},"content":{"rendered":"<h4 id=\"1-\u78c1\u76d8\u6ee1\u4e86\">1.\u00a0<strong>\u78c1\u76d8\u6ee1\u4e86<\/strong><\/h4>\n<p>\u5982\u679c\u4e00\u53f0\u673a\u5668\u78c1\u76d8\u6ee1\u4e86\uff0c\u9996\u5148\u6211\u4eec\u9700\u8981\u786e\u5b9a\u5176\u4f4d\u7f6e\uff0c\u547d\u4ee4\u4e3a<\/p>\n<pre class=\"prettyprint\"><code class=\"hljs lasso has-numbering\"> df\uff08\u6216\u8005df <span class=\"hljs-attribute\">-h<\/span>\uff09\r\n<span class=\"hljs-comment\">\/\/\u663e\u793a\u7ed3\u679c<\/span>\r\nFilesystem    <span class=\"hljs-number\">512<\/span><span class=\"hljs-attribute\">-blocks<\/span>      Used Available Capacity  iused    ifree <span class=\"hljs-subst\">%<\/span>iused  Mounted <span class=\"hljs-keyword\">on<\/span>\r\n\/dev\/disk0s2   <span class=\"hljs-number\">488555536<\/span> <span class=\"hljs-number\">124047536<\/span> <span class=\"hljs-number\">363996000<\/span>    <span class=\"hljs-number\">26<\/span><span class=\"hljs-subst\">%<\/span> <span class=\"hljs-number\">15569940<\/span> <span class=\"hljs-number\">45499500<\/span>   <span class=\"hljs-number\">25<\/span><span class=\"hljs-subst\">%<\/span>   <span class=\"hljs-subst\">\/<\/span>\r\ndevfs                <span class=\"hljs-number\">361<\/span>       <span class=\"hljs-number\">361<\/span>         <span class=\"hljs-number\">0<\/span>   <span class=\"hljs-number\">100<\/span><span class=\"hljs-subst\">%<\/span>      <span class=\"hljs-number\">626<\/span>        <span class=\"hljs-number\">0<\/span>  <span class=\"hljs-number\">100<\/span><span class=\"hljs-subst\">%<\/span>   \/dev\r\n<span class=\"hljs-built_in\">map<\/span> <span class=\"hljs-attribute\">-hosts<\/span>             <span class=\"hljs-number\">0<\/span>         <span class=\"hljs-number\">0<\/span>         <span class=\"hljs-number\">0<\/span>   <span class=\"hljs-number\">100<\/span><span class=\"hljs-subst\">%<\/span>        <span class=\"hljs-number\">0<\/span>        <span class=\"hljs-number\">0<\/span>  <span class=\"hljs-number\">100<\/span><span class=\"hljs-subst\">%<\/span>   \/net<\/code><\/pre>\n<p>\u627e\u5230\u90a3\u4e00\u5757\u76d8\u6ee1\u4e86\u4ee5\u540e\uff0c\u4f7f\u7528\u547d\u4ee4du\u4e00\u7ea7\u4e00\u7ea7\u7684\u67e5\u627e\uff0c\u786e\u5b9a\u6700\u5927\u6587\u4ef6\u3002<\/p>\n<pre class=\"prettyprint\"><code class=\"hljs lasso has-numbering\">    du <span class=\"hljs-attribute\">-h<\/span> <span class=\"hljs-subst\">--<\/span><span class=\"hljs-keyword\">max<\/span><span class=\"hljs-attribute\">-depth<\/span><span class=\"hljs-subst\">=<\/span><span class=\"hljs-number\">1<\/span> <span class=\"hljs-subst\">|<\/span> grep <span class=\"hljs-string\">'G'<\/span> <span class=\"hljs-subst\">|<\/span> sort <span class=\"hljs-attribute\">-n<\/span><\/code><\/pre>\n<p>\u5982\u679c\u662f\u65e5\u5fd7\u6587\u4ef6\u8fc7\u5927\u9700\u8981\u5220\u9664\u65f6\u5019\uff0c\u4f7f\u7528\u65e5\u5fd7\u5207\u5272\uff0c\u4fdd\u7559\u6700\u65b0\u65e5\u5fd7\u3002<\/p>\n<pre class=\"prettyprint\"><code class=\"hljs lasso has-numbering\"><span class=\"hljs-comment\">\/\/\u6307\u5b9a\u5206\u5272\u540e\u6587\u4ef6\u884c\u6570<\/span>\r\nsplit <span class=\"hljs-attribute\">-l<\/span> <span class=\"hljs-number\">300<\/span> largelog newlog\r\n<span class=\"hljs-comment\">\/\/\u6307\u5b9a\u5206\u5272\u540e\u6587\u4ef6\u5927\u5c0f<\/span>\r\n split <span class=\"hljs-attribute\">-b<\/span> <span class=\"hljs-number\">10<\/span>m largelog newlog<\/code><\/pre>\n<h4 id=\"2-\u8d1f\u8f7d\u8fc7\u9ad8\">2.\u00a0<strong>\u8d1f\u8f7d\u8fc7\u9ad8<\/strong><\/h4>\n<p>\u4f7f\u7528uptime\u547d\u4ee4\u67e5\u770b\u673a\u5668\u8d1f\u8f7d\u3002<\/p>\n<pre class=\"prettyprint\"><code class=\"hljs livecodeserver has-numbering\">uptime<span class=\"hljs-comment\">\r\n\/\/\u8f93\u51fa<\/span>\r\nup <span class=\"hljs-number\">1<\/span> day, <span class=\"hljs-number\">23<\/span>:<span class=\"hljs-number\">14<\/span>, <span class=\"hljs-number\">2<\/span> users, <span class=\"hljs-built_in\">load<\/span> averages: <span class=\"hljs-number\">1.69<\/span> <span class=\"hljs-number\">2.21<\/span> <span class=\"hljs-number\">2.09<\/span><\/code><\/pre>\n<p>\u5e73\u5747\u8d1f\u8f7d\u8868\u793a1\u30015\u300115\u5206\u949f\u8fdb\u7a0b\u961f\u5217\u4e2d\u7684\u5e73\u5747\u8fdb\u7a0b\u6570\u91cf\u3002\u4e00\u822c\u5355\u6838\u5927\u4e8e3\u7684\u8bdd\u8d1f\u8f7d\u5c31\u7b97\u9ad8\u4e86\u3002\u67e5\u770blinux\u591a\u5c11cpu\u4e0e\u6838\u7684\u547d\u4ee4\u5982\u4e0b\uff1a<\/p>\n<pre class=\"prettyprint\"><code class=\"hljs perl has-numbering\"> <span class=\"hljs-comment\">#\u67e5\u770b\u7269\u7406CPU\u4e2a\u6570<\/span>\r\ncat \/proc\/cpuinfo| <span class=\"hljs-keyword\">grep<\/span> <span class=\"hljs-string\">\"physical id\"<\/span>| <span class=\"hljs-keyword\">sort<\/span>| uni<span class=\"hljs-string\">q| wc -l\r\n#\u67e5\u770b\u6bcf\u4e2a\u7269\u7406CPU\u4e2dcore\u7684\u4e2a\u6570(\u5373\u6838\u6570)\r\ncat \/proc\/cpuinfo|<\/span> <span class=\"hljs-keyword\">grep<\/span> <span class=\"hljs-string\">\"cpu cores\"<\/span>| uniq\r\n<span class=\"hljs-comment\"># \u67e5\u770b\u903b\u8f91CPU\u7684\u4e2a\u6570<\/span>\r\ncat \/proc\/cpuinfo| <span class=\"hljs-keyword\">grep<\/span> <span class=\"hljs-string\">\"processor\"<\/span>| wc -l<\/code><\/pre>\n<p>\u7136\u540e\u4f7f\u7528top\u547d\u4ee4\u67e5\u770b\u6bcf\u4e2a\u8fdb\u7a0b\u5360\u7528CPU\uff0c\u5185\u5b58\u60c5\u51b5\u3002top\u663e\u793a\u65f6\u5019\u4f7f\u7528\u201cM\u201d\u8fdb\u7a0b\u4f1a\u6309\u5185\u5b58\u4f7f\u7528\u6392\u5e8f\uff0c\u6309\u201cP\u201d\u4f1a\u6309CPU\u4f7f\u7528\u6392\u5e8f\u3002<\/p>\n<p>\u5982\u679c\u6ca1\u6709\u8fdb\u7a0b\u5360\u7528\u5927\u91cfCPU\uff0c\u5185\u5b58\u8d44\u6e90\u7684\u8bdd\uff0c\u53ef\u80fd\u5c31\u662f\u67d0\u4e2a\u8fdb\u7a0b\u963b\u585e\u4e86\u3002\u4f7f\u7528ps -ef, \u770b\u5230\u54ea\u4e2a\u8fdb\u7a0b\u4f1a\u5361\u4f4f\uff0c\u7136\u540e\u53bb\/proc\/\u4e2d\u627e\u5230\u8fd9\u4e2a\u8fdb\u7a0b\u5bf9\u5e94\u7684\u6587\u4ef6\uff0c\u770b\u662f\u5426\u80fd\u6b63\u5e38\u6253\u5f00\u3002<\/p>\n<p>\u627e\u5230\u4ee5\u540e\u6740\u6b7b\u8fd9\u4e2a\u8fdb\u7a0b\u6216\u8005\u91cd\u542f\u673a\u5668\u3002<\/p>\n<h4 id=\"3-cant-lock-etcpasswdtry-again-later\">3.\u00a0<strong>can\u2019t lock \/etc\/passwd;try again later<\/strong><\/h4>\n<ol>\n<li>\u9996\u5148\u67e5\u770b\u662f\u5728\/etc\u4e0b\u5426\u5b58\u5728lock\u6587\u4ef6\uff0c<\/li>\n<\/ol>\n<pre class=\"prettyprint\"><code class=\"hljs lasso has-numbering\"><span class=\"hljs-variable\">$cd<\/span> \/etc  \r\n<span class=\"hljs-variable\">$ls<\/span> <span class=\"hljs-subst\">*<\/span><span class=\"hljs-built_in\">.<\/span>lock  \r\n$ rm <span class=\"hljs-attribute\">-f<\/span> <span class=\"hljs-subst\">*<\/span><span class=\"hljs-built_in\">.<\/span>lock <span class=\"hljs-comment\">\/\/\u5220\u9664\u6587\u4ef6\u9501  <\/span><\/code><\/pre>\n<ol>\n<li>\u6ca1\u6709\u7684\u8bdd\uff0c\u4f7f\u7528df -i\u770b\u662f\u5426 inode\u6ee1\u4e86\uff0c\u5982\u679c\u662f\u00a0 \u67e5\u627e\u6bcf\u4e2a\u6587\u4ef6\u4e0b\u7684\u6587\u4ef6\u6570\u76ee<\/li>\n<\/ol>\n<pre class=\"prettyprint\"><code class=\"hljs bash has-numbering\"><span class=\"hljs-keyword\">for<\/span> i <span class=\"hljs-keyword\">in<\/span> .\/*; <span class=\"hljs-keyword\">do<\/span> <span class=\"hljs-built_in\">echo<\/span> <span class=\"hljs-variable\">$i<\/span>; find <span class=\"hljs-variable\">$i<\/span> | wc <span class=\"hljs-operator\">-l<\/span> |sort -n ; <span class=\"hljs-keyword\">done<\/span><\/code><\/pre>\n<p>\u627e\u5230\u540e\u5220\u9664\u6ca1\u7528\u7684\u5c0f\u6587\u4ef6\u3002\u00a0 \u5efa\u8bae\u53bb\/var\/spool\/postfix\/maildrop\u53bb\u770b\u770b\u3002<\/p>\n<p>\u79d1\u666e\u4e00\u4e0bdf -i\u4e0edf -h\uff0c\u4e00\u4e2a\u662f\u603b\u5171\u80fd\u521b\u5efa\u591a\u5c11\u6587\u4ef6\uff0c\u4e00\u4e2a\u662f\u603b\u5171\u80fd\u521b\u5efa\u591a\u5927\u7684\u6587\u4ef6\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>1.\u00a0\u78c1\u76d8\u6ee1\u4e86 \u5982\u679c\u4e00\u53f0\u673a\u5668\u78c1\u76d8\u6ee1\u4e86\uff0c\u9996\u5148\u6211\u4eec\u9700\u8981\u786e\u5b9a\u5176\u4f4d\u7f6e\uff0c\u547d\u4ee4\u4e3a df\uff08\u6216\u8005df -h\uff09 \/\/\u663e\u793a\u7ed3\u679c F &#8230; <a title=\"\u89e3\u51b3linux\u78c1\u76d8\u6ee1\u4e86\u4ee5\u53ca\u8d1f\u8f7d\u8fc7\u9ad8\u529e\u6cd5\" class=\"read-more\" href=\"https:\/\/cn.hostease.com\/xueyuan\/hemanual\/%e8%a7%a3%e5%86%b3linux%e7%a3%81%e7%9b%98%e6%bb%a1%e4%ba%86%e4%bb%a5%e5%8f%8a%e8%b4%9f%e8%bd%bd%e8%bf%87%e9%ab%98%e5%8a%9e%e6%b3%95\/\" aria-label=\"\u9605\u8bfb \u89e3\u51b3linux\u78c1\u76d8\u6ee1\u4e86\u4ee5\u53ca\u8d1f\u8f7d\u8fc7\u9ad8\u529e\u6cd5\">\u9605\u8bfb\u66f4\u591a<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[3,49,5],"tags":[38],"class_list":["post-3072","post","type-post","status-publish","format-standard","hentry","category-hemanual","category-linux","category-jishu","tag-linux"],"aioseo_notices":[],"jetpack_featured_media_url":"","jetpack-related-posts":[],"jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/cn.hostease.com\/xueyuan\/wp-json\/wp\/v2\/posts\/3072","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/cn.hostease.com\/xueyuan\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/cn.hostease.com\/xueyuan\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/cn.hostease.com\/xueyuan\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/cn.hostease.com\/xueyuan\/wp-json\/wp\/v2\/comments?post=3072"}],"version-history":[{"count":1,"href":"https:\/\/cn.hostease.com\/xueyuan\/wp-json\/wp\/v2\/posts\/3072\/revisions"}],"predecessor-version":[{"id":3073,"href":"https:\/\/cn.hostease.com\/xueyuan\/wp-json\/wp\/v2\/posts\/3072\/revisions\/3073"}],"wp:attachment":[{"href":"https:\/\/cn.hostease.com\/xueyuan\/wp-json\/wp\/v2\/media?parent=3072"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/cn.hostease.com\/xueyuan\/wp-json\/wp\/v2\/categories?post=3072"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/cn.hostease.com\/xueyuan\/wp-json\/wp\/v2\/tags?post=3072"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}