{"id":365,"date":"2017-05-12T09:00:00","date_gmt":"2017-05-12T00:00:00","guid":{"rendered":"https:\/\/p-corporate-blog-cms.mmmcorp.co.jp\/blog\/2017\/05\/12\/troubleshooting_linux_command"},"modified":"2017-05-12T09:00:00","modified_gmt":"2017-05-12T00:00:00","slug":"troubleshooting_linux_command","status":"publish","type":"post","link":"https:\/\/p-corporate-blog-cms.mmmcorp.co.jp\/blog\/2017\/05\/12\/troubleshooting_linux_command\/","title":{"rendered":"\u969c\u5bb3\u8abf\u67fb\u306b\u5f79\u7acb\u3064\u57fa\u790e\u7684\u306aLinux\u30b3\u30de\u30f3\u30c9\u96c6"},"content":{"rendered":"

Linux\u30b5\u30fc\u30d0\u3067\u306eWeb\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u306e\u969c\u5bb3\u8abf\u67fb\u6642\u306b\u3001\u81ea\u5206\u304c\u7279\u306b\u3088\u304f\u4f7f\u3063\u3066\u3044\u308b\u57fa\u790e\u7684\u306a\u30b3\u30de\u30f3\u30c9\u3092\u307e\u3068\u3081\u3066\u307f\u307e\u3057\u305f\u3002\u7d71\u8a08\u306a\u3069\u3092\u53d6\u3063\u305f\u308f\u3051\u3067\u306f\u306a\u3044\u3067\u3059\u304c\u3001\u4eca\u56de\u6319\u3052\u308b\u57fa\u790e\u7684\u306a\u30b3\u30de\u30f3\u30c9\u3067\u591a\u304f\u306e\u8abf\u67fb\u3092\u6e08\u307e\u305b\u3066\u3057\u307e\u3063\u3066\u3044\u308b\u6c17\u304c\u3057\u307e\u3059\u3002
\n\u5b9f\u969b\u306b\u306f\u3001\u30d1\u30a4\u30d7\u3067 sort<\/code> \u3084 wc<\/code> \u30b3\u30de\u30f3\u30c9\u306a\u3069\u3068\u7d44\u307f\u5408\u308f\u305b\u305f\u308a\u3059\u308b\u3053\u3068\u3067\u8abf\u67fb\u306e\u9ad8\u901f\u5316\u3092\u3057\u3066\u3044\u308b\u90e8\u5206\u3082\u3042\u308a\u307e\u3059\u304c\u3001\u5b9f\u969b\u306b\u306f\u57fa\u790e\u7684\u306a\u30b3\u30de\u30f3\u30c9\u3060\u3051\u3067\u969c\u5bb3\u306e\u539f\u56e0\u304c\u5224\u660e\u3059\u308b\u3053\u3068\u3082\u591a\u304f\u3042\u308a\u307e\u3059\u3002<\/p>\n

w<\/h1>\n

\u30de\u30b7\u30f3\u306e\u8d77\u52d5\u6642\u9593\u3084\u3001\u30ed\u30b0\u30a4\u30f3\u3057\u3066\u3044\u308b\u30e6\u30fc\u30b6\u306a\u3069\u3092\u8abf\u3079\u308b\u30b3\u30de\u30f3\u30c9\u3067\u3059\u3002
\n\u7279\u306b\u3001\u30de\u30b7\u30f3\u306e\u518d\u8d77\u52d5\u304c\u969c\u5bb3\u306e\u539f\u56e0\u306b\u306a\u308b\u3053\u3068\u306f\u591a\u3005\u3042\u308b\u306e\u3067\u3001\u30de\u30b7\u30f3\u306e\u8d77\u52d5\u6642\u9593\u306f\u8abf\u67fb\u306b\u91cd\u8981\u306a\u60c5\u5831\u3068\u306a\u308a\u307e\u3059\u3002
\n\u307e\u305f\u3001\u4ed6\u306e\u4eba\u304c\u30ed\u30b0\u30a4\u30f3\u3057\u3066\u3044\u308b\u5834\u5408\u3001\u8abf\u67fb\u306b\u5f71\u97ff\u3092\u4e0e\u3048\u308b\u5834\u5408\u304c\u3042\u308b\u305f\u3081\u6ce8\u610f\u3057\u307e\u3059\u3002
\n\u3053\u308c\u3089\u306e\u60c5\u5831\u304c\u4e00\u6587\u5b57\u3067\u53d6\u5f97\u3067\u304d\u308b\u306e\u3067\u3059\u304b\u3089\u3001\u307e\u305a\u6253\u3063\u3066\u304a\u3044\u3066\u640d\u306f\u3042\u308a\u307e\u305b\u3093\u3002<\/p>\n

df<\/h1>\n

\u30c7\u30a3\u30b9\u30af\u4f7f\u7528\u91cf\u3092\u78ba\u8a8d\u3059\u308b\u30b3\u30de\u30f3\u30c9\u3067\u3059\u3002\u30c7\u30a3\u30b9\u30af\u306e\u4f7f\u7528\u7387\u3092\u76e3\u8996\u3057\u3066\u3044\u306a\u3044\u5834\u5408\u3001\u969c\u5bb3\u767a\u751f\u306e\u539f\u56e0\u304c\u30c7\u30a3\u30b9\u30af\u306e\u67af\u6e07\u3068\u3044\u3046\u30b1\u30fc\u30b9\u3082\u591a\u3044\u306e\u3067\u3001\u3053\u306e\u30b3\u30de\u30f3\u30c9\u3082\u6700\u521d\u306b\u6253\u3063\u3066\u307f\u308b\u30b3\u30de\u30f3\u30c9\u306e1\u3064\u3067\u3059\u3002<\/p>\n

$ df -h\nFilesystem      Size  Used Avail Use% Mounted on\n\/dev\/xvda1       30G   10G   20G  34% \/\ndevtmpfs        490M   56K  490M   1% \/dev\ntmpfs           499M     0  499M   0% \/dev\/shm<\/code><\/pre>\n

du<\/h1>\n

\u30c7\u30a3\u30b9\u30af\u5bb9\u91cf\u304c\u67af\u6e07\u3057\u3066\u3044\u308b\u5834\u5408\u3001\u3069\u306e\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u304c\u5bb9\u91cf\u3092\u53d6\u3063\u3066\u3044\u308b\u304b\u3092\u8abf\u3079\u308b\u969b\u306b\u4f7f\u3046\u3053\u3068\u304c\u591a\u3044\u3067\u3057\u3087\u3046\u304b\u3002<\/p>\n

\u4f8b) \u73fe\u5728\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u76f4\u4e0b\u306e\u30c7\u30a3\u30b9\u30af\u5bb9\u91cf\u3092\u8abf\u3079\u305f\u3044\u5834\u5408:<\/p>\n

$ du -sh .\/*\n22M    .\/20151120\n280K    .\/hogehoge.jpg\n308M    .\/hogehoge.tar.gz\n8.0K    .\/bin\n28K    .\/blog<\/code><\/pre>\n

\u30d1\u30a4\u30d7\u3067 sort -rn<\/code> \u3092\u3064\u306a\u3052\u308b\u3068\u5bb9\u91cf\u3054\u3068\u306b\u30bd\u30fc\u30c8\u53ef\u80fd\u3067\u3059\u3002<\/p>\n

$ du -sh .\/* | sort -rn\n620M    .\/hogehoge.dump\n508M    .\/shimojo\n496K    .\/maeda\n355M    .\/dump.sql\n308M    .\/hoge.dump.tar.gz<\/code><\/pre>\n

\u96a0\u3057\u30d5\u30a1\u30a4\u30eb\u3082\u5bfe\u8c61\u306b\u3057\u305f\u3044\u5834\u5408\u3001\u4ee5\u4e0b\u306e\u3088\u3046\u306b\u3057\u307e\u3059\u3002<\/p>\n

$ du -scmh .\/* .\/.[^.]* | sort -rn\n620M    .\/hogehoge.dump\n508M    .\/shimojo\n496K    .\/maeda\n355M    .\/dump.sql\n308M    .\/hoge.dump.tar.gz\n136K    .\/.ssh<\/code><\/pre>\n

ps<\/h1>\n

\u30d7\u30ed\u30bb\u30b9\u3092\u8868\u793a\u3059\u308b\u30b3\u30de\u30f3\u30c9\u3067\u3059\u3002
\n\u500b\u4eba\u7684\u306b\u306f ps aux<\/code> \u30aa\u30d7\u30b7\u30e7\u30f3\u3067\u6253\u3064\u3053\u3068\u304c\u591a\u3044\u3067\u3059\u3002
\n\u4f8b\u3048\u3070Web\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u304b\u3089\u30ec\u30b9\u30dd\u30f3\u30b9\u304c\u306a\u3044\u3088\u3046\u306a\u3068\u304d\u3001\u5fc5\u8981\u306a\u30d7\u30ed\u30bb\u30b9 (Web\u30b5\u30fc\u30d0\u3084\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u30b5\u30fc\u30d0) \u304c\u52d5\u3044\u3066\u3044\u308b\u306e\u304b\u3068\u3044\u3063\u305f\u3068\u3053\u308d\u306f\u3001\u307e\u305a\u78ba\u8a8d\u3057\u305f\u3044\u30dd\u30a4\u30f3\u30c8\u3067\u3059\u3002<\/p>\n

top<\/h1>\n

\u30ea\u30a2\u30eb\u30bf\u30a4\u30e0\u306b\u73fe\u5728\u306e\u30b7\u30b9\u30c6\u30e0\u8ca0\u8377\u72b6\u6cc1\u3092\u898b\u308b\u969b\u306b\u4f7f\u3044\u307e\u3059\u3002
\nCPU\u8ca0\u8377\u306b\u3064\u3044\u3066\u306f\u57fa\u672c\u7684\u306bst\u306e\u5024\u306f\u4f4e\u3044\u306f\u305a\u3067\u3059\u304c\u3001\u6700\u8fd1\u3042\u3063\u305f\u4e8b\u4f8b\u3068\u3057\u3066\u3001AWS\u306et\u7cfb\u30a4\u30f3\u30b9\u30bf\u30f3\u30b9\u3067st\u306e\u5024\u304c\u9ad8\u304f\u306a\u3063\u3066\u3044\u3066\u3001\u5b9f\u969b\u306b\u306fCPU\u30af\u30ec\u30b8\u30c3\u30c8\u3092\u4f7f\u3044\u5207\u3063\u3066\u3057\u307e\u3063\u3066CPU\u306e\u4f7f\u7528\u304c\u5236\u9650\u3055\u308c\u3066\u3057\u307e\u3063\u3066\u3044\u305f\u3068\u3044\u3046\u30b1\u30fc\u30b9\u304c\u6700\u8fd1\u3042\u308a\u307e\u3057\u305f\u3002<\/p>\n

grep<\/h1>\n

\u30ed\u30b0\u30d5\u30a1\u30a4\u30eb\u306e\u89e3\u6790\u3092\u3059\u308b\u305f\u3081\u306b\u591a\u7528\u3057\u307e\u3059\u3002<\/p>\n

find<\/h1>\n

\u30d5\u30a1\u30a4\u30eb\u3092\u898b\u3064\u3051\u308b\u305f\u3081\u306b\u305f\u307e\u306b\u4f7f\u3044\u307e\u3059\u3002<\/p>\n

echo $?<\/h1>\n

\u524d\u56de\u5b9f\u884c\u3057\u305f\u30b3\u30de\u30f3\u30c9\u306e\u5fa9\u5e30\u5024\u3092\u8868\u793a\u3059\u308b\u30b3\u30de\u30f3\u30c9\u3067\u3059\u3002\u4f55\u304b\u3057\u3089\u306e\u30b3\u30de\u30f3\u30c9\u3092\u30c7\u30d0\u30c3\u30b0\u306e\u305f\u3081\u518d\u5ea6\u5b9f\u884c\u3057\u305f\u3042\u3068\u306b\u3001\u305d\u306e\u5fa9\u5e30\u5024\u3092\u78ba\u8a8d\u3059\u308b\u969b\u306b\u4f7f\u3046\u3053\u3068\u304c\u3042\u308a\u307e\u3059\u3002<\/p>\n

\u4ee5\u4e0a\u3001\u57fa\u790e\u7684\u30b3\u30de\u30f3\u30c9\u3092\u3054\u7d39\u4ecb\u3057\u307e\u3057\u305f\u3002\u4eca\u56de\u6319\u3052\u305f\u30b3\u30de\u30f3\u30c9\u3092\u4f7f\u3044\u3053\u306a\u3059\u3060\u3051\u3067\u3082\u304b\u306a\u308a\u306e\u8abf\u67fb\u304c\u53ef\u80fd\u3060\u3068\u601d\u3044\u307e\u3059\u306e\u3067\u3001\u3053\u308c\u304b\u3089\u30c8\u30e9\u30d6\u30eb\u30b7\u30e5\u30fc\u30c6\u30a3\u30f3\u30b0\u306b\u643a\u308f\u308b\u3068\u3044\u3046\u65b9\u306b\u53c2\u8003\u306b\u306a\u308c\u3070\u5e78\u3044\u3067\u3059\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"

Linux\u30b5\u30fc\u30d0\u3067\u306eWeb\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u306e\u969c\u5bb3\u8abf\u67fb\u6642\u306b\u3001\u81ea\u5206\u304c\u7279\u306b\u3088\u304f\u4f7f\u3063\u3066\u3044\u308b\u57fa\u790e\u7684\u306a\u30b3\u30de\u30f3\u30c9\u3092\u307e\u3068\u3081\u3066\u307f\u307e\u3057\u305f\u3002\u7d71\u8a08\u306a\u3069\u3092\u53d6\u3063\u305f\u308f\u3051\u3067\u306f\u306a\u3044\u3067\u3059\u304c\u3001\u4eca\u56de\u6319\u3052\u308b\u57fa\u790e\u7684\u306a\u30b3\u30de\u30f3\u30c9\u3067\u591a\u304f\u306e\u8abf\u67fb\u3092\u6e08\u307e\u305b\u3066\u3057\u307e\u3063\u3066\u3044\u308b\u6c17\u304c\u3057\u307e\u3059\u3002 \u5b9f\u969b\u306b\u306f\u3001\u30d1\u30a4\u30d7\u3067 sort \u3084 wc \u30b3\u30de\u30f3\u30c9\u306a\u3069\u3068\u7d44\u307f\u5408\u308f\u305b\u305f\u308a\u3059\u308b\u3053\u3068\u3067\u8abf\u67fb\u306e\u9ad8\u901f\u5316\u3092\u3057\u3066\u3044\u308b\u90e8\u5206\u3082\u3042\u308a\u307e\u3059\u304c\u3001\u5b9f\u969b\u306b\u306f\u57fa\u790e\u7684\u306a\u30b3\u30de\u30f3\u30c9\u3060\u3051\u3067\u969c\u5bb3\u306e\u539f\u56e0\u304c\u5224\u660e\u3059\u308b\u3053\u3068 […]<\/p>\n","protected":false},"author":4,"featured_media":826,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[18],"tags":[264],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/p-corporate-blog-cms.mmmcorp.co.jp\/wp-json\/wp\/v2\/posts\/365"}],"collection":[{"href":"https:\/\/p-corporate-blog-cms.mmmcorp.co.jp\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/p-corporate-blog-cms.mmmcorp.co.jp\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/p-corporate-blog-cms.mmmcorp.co.jp\/wp-json\/wp\/v2\/users\/4"}],"replies":[{"embeddable":true,"href":"https:\/\/p-corporate-blog-cms.mmmcorp.co.jp\/wp-json\/wp\/v2\/comments?post=365"}],"version-history":[{"count":0,"href":"https:\/\/p-corporate-blog-cms.mmmcorp.co.jp\/wp-json\/wp\/v2\/posts\/365\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/p-corporate-blog-cms.mmmcorp.co.jp\/wp-json\/wp\/v2\/media\/826"}],"wp:attachment":[{"href":"https:\/\/p-corporate-blog-cms.mmmcorp.co.jp\/wp-json\/wp\/v2\/media?parent=365"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/p-corporate-blog-cms.mmmcorp.co.jp\/wp-json\/wp\/v2\/categories?post=365"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/p-corporate-blog-cms.mmmcorp.co.jp\/wp-json\/wp\/v2\/tags?post=365"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}