{"id":435,"date":"2024-02-29T22:21:19","date_gmt":"2024-02-29T14:21:19","guid":{"rendered":"https:\/\/www.gonait.com\/?p=435"},"modified":"2024-03-16T19:03:07","modified_gmt":"2024-03-16T11:03:07","slug":"linux%e4%bd%bf%e7%94%a8%e8%ae%b0%e5%bd%95","status":"publish","type":"post","link":"https:\/\/www.gonait.com\/?p=435","title":{"rendered":"Linux\u4f7f\u7528\u8bb0\u5f55"},"content":{"rendered":"<h1>Linux<\/h1>\n<h2><a href=\"https:\/\/www.toutiao.com\/article\/7310203870620680730\/?app=news_article&timestamp=1702465376&use_new_style=1&req_id=2023121319025544D1038367EABA0E4468&group_id=7310203870620680730&wxshare_count=1&tt_from=weixin&utm_source=weixin&utm_medium=toutiao_android&utm_campaign=client_share&share_token=3545357c-02ea-457a-89ff-617aeae061bf&source=m_redirect\">25.8K \u5f00\u6e90\u7684 Linux \u547d\u4ee4\u901f\u67e5\u624b\u518c\uff0c\u53ef\u672c\u5730\u90e8\u7f72<\/a><\/h2>\n<blockquote><p>\ndocker \u90e8\u7f72 linux-command \u7f51\u9875\u7248\uff0c\u9879\u76ee\u5730\u5740\uff1a<a href=\"https:\/\/github.com\/jaywcjlove\/linux-command\">https:\/\/github.com\/jaywcjlove\/linux-command<\/a><\/p>\n<pre><code>#\u62c9\u53d6\u955c\u50cf\ndocker pull wcjiang\/linux-command\n\n#\u542f\u52a8\ndocker run --name linux-command --rm -d -p 9665:3000 wcjiang\/linux-command:latest<\/code><\/pre>\n<\/blockquote>\n<h2>\u57fa\u672c\u547d\u4ee4<\/h2>\n<ul>\n<li>\n\u67e5\u770b\u7cfb\u7edf\u7684\u53d1\u884c\u7248\u4fe1\u606f <code>cat \/etc\/os-release<\/code>\n<\/li>\n<li>\n\u67e5\u770b\u4e3b\u673a\u7684\u4fe1\u606f <code>hostnamectl<\/code>\n<\/li>\n<li>\n\u5b9e\u65f6\u76d1\u63a7\u7cfb\u7edf\u7684\u8fd0\u884c\u72b6\u6001 <code>top<\/code>\n<\/li>\n<li>\nCPU\u8be6\u7ec6\u4fe1\u606f\uff1a<code>lscpu<\/code>\n<\/li>\n<li>\n\u5185\u5b58\u4f7f\u7528\u60c5\u51b5\uff1a<code>free -h<\/code>\n<\/li>\n<li>\n\u7f51\u7edc\u8fde\u63a5\u76f8\u5173\u4fe1\u606f\uff1a<code>netstat<\/code>\n<\/li>\n<li>\n\u78c1\u76d8\u76f8\u5173\u4fe1\u606f\uff1a<code>df -h<\/code>\n<\/li>\n<li>\n\u67e5\u770b\u5f53\u524d\u7528\u6237\uff1a<code>whoami<\/code>\n<\/li>\n<li>\n\u67e5\u770b\u5f53\u524d\u7528\u6237\u5206\u7ec4\uff1a<code>group<\/code>\n<\/li>\n<li>\n\u67e5\u770b\u5168\u90e8\u7528\u6237\u7ec4\uff1a<code>cat \/etc\/group<\/code>\n<\/li>\n<li>\n\u6dfb\u52a0\u3001\u5220\u9664\u7ec4\u8d26\u53f7\uff1a<code>groupadd\u3001groupdel<\/code>\n<\/li>\n<li>\n\u7ba1\u9053\u547d\u4ee4\u6253\u5370\u6807\u9898\u884c\uff1a<code>ps -ef | head -1; ps -ef | grep -n elastic <\/code>\n<\/li>\n<li>\n\u8fdc\u7a0b\u4f20\u8f93\u6587\u4ef6\u65b9\u5f0f\uff1a\u8fdc\u7a0b\u670d\u52a1\u5668\u95f4\u4f20\u8f93\u6587\u4ef6\u8fdc\u7a0b\u590d\u5236\u6587\u4ef6<\/p>\n<ul>\n<li>\u53c2\u8003\uff1a<a href=\"https:\/\/zhuanlan.zhihu.com\/p\/507876254\">https:\/\/zhuanlan.zhihu.com\/p\/507876254<\/a><\/li>\n<li>scp\uff1a\u5df2\u5f03\u7528\u7684\u65e7\u547d\u4ee4<\/li>\n<li>rsync\uff1a\u7528\u4e8e\u6587\u4ef6\u540c\u6b65\u7684\u6d41\u884c\u547d\u4ee4<\/li>\n<li>sshfs\uff1a\u901a\u8fc7 SSH \u6302\u8f7d\u8fdc\u7a0b\u76ee\u5f55<\/li>\n<li>sftp \u5ba2\u6237\u7aef\uff1a\u901a\u8fc7 SFTP \u8bbf\u95ee\u6587\u4ef6\u7684 GUI \u5de5\u5177<\/li>\n<\/ul>\n<\/li>\n<li>\n\u67e5\u627e\u6587\u4ef6\u6216\u76ee\u5f55\uff1a<code> find \/ -type f -name &quot;name&quot;<\/code>\n<\/li>\n<li>\nldd\u547d\u4ee4<br \/>\nLDD \u547d\u4ee4\u5728Linux\u7cfb\u7edf\u4e2d\u7528\u4e8e\u663e\u793a\u4e00\u4e2a\u4e8c\u8fdb\u5236\u6587\u4ef6\u6240\u9700\u7684\u6240\u6709\u5171\u4eab\u5e93\u53ca\u5176\u4f9d\u8d56\u5173\u7cfb\u3002\u5b83\u53ef\u4ee5\u5e2e\u52a9\u7cfb\u7edf\u7ba1\u7406\u5458\u548c\u5f00\u53d1\u8005\u5728\u8fdb\u884c\u8f6f\u4ef6\u5305\u7ba1\u7406\u548c\u8c03\u8bd5\u65f6\u8bc6\u522b\u95ee\u9898\u3002LDD\u547d\u4ee4\u901a\u5e38\u7528\u4e8e\u9a8c\u8bc1\u8f6f\u4ef6\u5305\u662f\u5426\u6b63\u786e\u5b89\u88c5\uff0c\u786e\u8ba4\u5b83\u4eec\u4e4b\u95f4\u7684\u4f9d\u8d56\u5173\u7cfb\uff0c\u4ee5\u53ca\u5728\u7279\u5b9a\u73af\u5883\u4e0b\u7684\u884c\u4e3a\u3002\n<\/li>\n<\/ul>\n<p>\u8981\u4f7f\u7528LDD\u547d\u4ee4\uff0c\u53ef\u4ee5\u901a\u8fc7\u7ec8\u7aef\u8f93\u5165<code>ldd<\/code>\u540e\u8ddf\u7a7a\u683c\u548c\u9700\u8981\u5206\u6790\u7684\u4e8c\u8fdb\u5236\u6587\u4ef6\u7684\u8def\u5f84\u3002\u4f8b\u5982\uff0c\u8fd0\u884c<code>ldd \/path\/to\/your_program<\/code>\u53ef\u4ee5\u83b7\u53d6\u8be5\u7a0b\u5e8f\u6240\u9700\u7684\u5171\u4eab\u5e93\u548c\u5176\u4ed6\u76f8\u5173\u4fe1\u606f\u3002\u6b64\u5916\uff0c\u8fd8\u53ef\u4ee5\u901a\u8fc7\u4f20\u9012\u4e0d\u540c\u7684\u9009\u9879\u6765\u5b9a\u5236\u8f93\u51fa\uff0c\u5982<code>-v<\/code>\uff08\u663e\u793a\u8be6\u7ec6\u7248\u672c\u4fe1\u606f\uff09\u6216<code>-u<\/code>\uff08\u5217\u51fa\u672a\u88ab\u4f7f\u7528\u7684\u5171\u4eab\u5e93\uff09\u3002<\/p>\n<p>\u603b\u7ed3\u6765\u8bf4\uff0cLDD\u547d\u4ee4\u662f\u4e00\u4e2a\u6709\u7528\u7684\u5de5\u5177\uff0c\u5c24\u5176\u5728\u5904\u7406\u5171\u4eab\u5e93\u4f9d\u8d56\u6027\u548c\u786e\u4fdd\u8f6f\u4ef6\u5305\u6b63\u786e\u5b89\u88c5\u65b9\u9762\u53d1\u6325\u4f5c\u7528<\/p>\n<h2>Linux\u8def\u5f84\u76ee\u5f55\u89e3\u91ca<\/h2>\n<blockquote><p>\n\u53c2\u8003\uff1a<a href=\"https:\/\/blog.csdn.net\/qq_16268979\/article\/details\/110001261?spm=1001.2101.3001.6650.2&utm_medium=distribute.pc_relevant.none-task-blog-2%7Edefault%7EBlogCommendFromBaidu%7ERate-2-110001261-blog-129047825.235%5Ev38%5Epc_relevant_anti_vip_base&depth_1-utm_source=distribute.pc_relevant.none-task-blog-2%7Edefault%7EBlogCommendFromBaidu%7ERate-2-110001261-blog-129047825.235%5Ev38%5Epc_relevant_anti_vip_base&utm_relevant_index=3\">linux\u6587\u4ef6\u76ee\u5f55<\/a>\n<\/p><\/blockquote>\n<table>\n<thead>\n<tr>\n<th>\u76ee\u5f55<\/th>\n<th>\u8bf4\u660e<\/th>\n<th>\u5907\u6ce8<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td>\/<\/td>\n<td>\u6839\u76ee\u5f55<\/td>\n<td><\/td>\n<\/tr>\n<tr>\n<td>\/bin<\/td>\n<td>\u5b58\u653e\u4e8c\u8fdb\u5236\u53ef\u6267\u884c\u6587\u4ef6\uff0c\u6307\u5411usr\/bin<\/td>\n<td>\u5e38\u7528\u547d\u4ee4\u5b58\u653e\u5728\u6b64\u5904\uff0c\u5982ls\u3001cat\u3001mkdir\u7b49<\/td>\n<\/tr>\n<tr>\n<td>\/boot<\/td>\n<td>Linux\u6838\u5fc3\u76f8\u5173\u6587\u4ef6<\/td>\n<td><\/td>\n<\/tr>\n<tr>\n<td>\/dev<\/td>\n<td>\u7cfb\u7edf\u7684\u8bbe\u5907\u6587\u4ef6\uff0c\u5373\u8bbe\u5907\u7684\u9a71\u52a8\u7a0b\u5e8f<\/td>\n<td>\u5982disk\u3001cpu\u3001net\u7b49\u7cfb\u7edf\u8bbe\u5907<\/td>\n<\/tr>\n<tr>\n<td>\/etc<\/td>\n<td>\u7cfb\u7edf\u7684\u914d\u7f6e\u6587\u4ef6<\/td>\n<td>\u5982hosts\u3001systemd\u3001sysctl.d\u7b49<\/td>\n<\/tr>\n<tr>\n<td>\/home<\/td>\n<td>\u7528\u6237\u4e3b\u76ee\u5f55\u6587\u4ef6<\/td>\n<td>\u5982zhangsan\u3001lisi\u7528\u6237\u7684\u76ee\u5f55<\/td>\n<\/tr>\n<tr>\n<td>\/lib<\/td>\n<td>\u7cfb\u7edf\u8fd0\u884c\u76f8\u5173\u7684    \u5e93\u6587\u4ef6<\/td>\n<td><\/td>\n<\/tr>\n<tr>\n<td>\/media<\/td>\n<td>\u81ea\u52a8\u8bc6\u522b\u7684\u5916\u90e8\u8bbe\u5907\uff0c\u53ef\u79fb\u9664\u8bbe\u5907<\/td>\n<td>\u5982\u5149\u76d8\u3001\u8f6f\u76d8\u7b49<\/td>\n<\/tr>\n<tr>\n<td>\/mnt<\/td>\n<td>\u7cfb\u7edf\u7ba1\u7406\u5458\u5b89\u88c5\u4e34\u65f6\u6587\u4ef6\u7cfb\u7edf\u7684\u5b89\u88c5\u70b9\uff0c\u7cfb\u7edf\u63d0\u4f9b\u8fd9\u4e2a\u76ee\u5f55\u662f\u8ba9\u7528\u6237\u4e34\u65f6\u6302\u8f7d\u5176\u4ed6\u7684\u6587\u4ef6\u7cfb\u7edf\u3002<\/td>\n<td><\/td>\n<\/tr>\n<tr>\n<td>\/opt<\/td>\n<td>(option : \u81ea\u7531\u9009\u62e9)\u4e3b\u8981\u7ed9\u6e90\u7801\u5b89\u88c5\u8f6f\u4ef6\u65f6\u9009\u62e9\u7684\u5b89\u88c5\u76ee\u5f55\u4f4d\u7f6e<\/td>\n<td>\u5982\u5b89\u88c5tomcat\u7b49<\/td>\n<\/tr>\n<tr>\n<td>\/proc<\/td>\n<td>\u865a\u62df\u6587\u4ef6\u7cfb\u7edf\u76ee\u5f55\uff0c\u662f\u7cfb\u7edf\u5185\u5b58\u7684\u6620\u5c04\u3002\u53ef\u76f4\u63a5\u8bbf\u95ee\u8fd9\u4e2a\u76ee\u5f55\u6765\u83b7\u53d6\u7cfb\u7edf\u4fe1\u606f\u3002<\/td>\n<td><\/td>\n<\/tr>\n<tr>\n<td>\/root<\/td>\n<td>\u8d85\u7ea7\u7528\u6237\uff08\u7cfb\u7edf\u7ba1\u7406\u5458\uff09\u7684\u4e3b\u76ee\u5f55<\/td>\n<td><\/td>\n<\/tr>\n<tr>\n<td>\/run<\/td>\n<td>\u7cfb\u7edf\u542f\u52a8\u540e\u7684\u4e00\u4e9b\u4e34\u65f6\u6587\u4ef6<\/td>\n<td><\/td>\n<\/tr>\n<tr>\n<td>\/sbin<\/td>\n<td>\u5b58\u653e\u4e8c\u8fdb\u5236\u53ef\u6267\u884c\u6587\u4ef6\uff0c\u53ea\u6709root\u624d\u80fd\u8bbf\u95ee\u3002\u6307\u5411usr\/sbin<\/td>\n<td>\u5982iptables\u3001ifconfig\u7b49<\/td>\n<\/tr>\n<tr>\n<td>\/srv<\/td>\n<td>\u7cfb\u7edf\u542f\u52a8\u670d\u52a1\u65f6\u53ef\u4ee5\u8bbf\u95ee\u7684\u6570\u636e\u76ee\u5f55<\/td>\n<td><\/td>\n<\/tr>\n<tr>\n<td>\/sys<\/td>\n<td>\u7cfb\u7edf\u8bbe\u5907\u7ba1\u7406\u76f8\u5173\u7684\u6587\u4ef6<\/td>\n<td><\/td>\n<\/tr>\n<tr>\n<td>\/tmp<\/td>\n<td>\u4e34\u65f6\u6587\u4ef6\uff0c\u91cd\u542f\u540e\u81ea\u52a8\u6e05\u7a7a<\/td>\n<td><\/td>\n<\/tr>\n<tr>\n<td>\/usr<\/td>\n<td>\u6700\u5927\u7684\u76ee\u5f55\uff0c\u5b58\u653e\u7740\u5e94\u7528\u7a0b\u5e8f\u548c\u6587\u4ef6<\/td>\n<td><\/td>\n<\/tr>\n<tr>\n<td>\/var<\/td>\n<td>\u67d0\u4e9b\u5927\u6587\u4ef6\u7684\u6ea2\u51fa\u533a\uff0c\u6bd4\u5982\u5404\u79cd\u670d\u52a1\u7684\u65e5\u5fd7\u6587\u4ef6<\/td>\n<td>\u7528\u4e8e\u5b58\u653e\u8fd0\u884c\u65f6\u9700\u8981\u6539\u53d8\u6570\u636e\u7684\u6587\u4ef6<\/td>\n<\/tr>\n<tr>\n<td>\/lost+found<\/td>\n<td>\u8fd9\u4e2a\u76ee\u5f55\u5e73\u65f6\u662f\u7a7a\u7684\uff0c\u7cfb\u7edf\u975e\u6b63\u5e38\u5173\u673a\u800c\u7559\u4e0b\u201c\u65e0\u5bb6\u53ef\u5f52\u201d\u7684\u6587\u4ef6<\/td>\n<td><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<h2>Linux\u6027\u80fd\u5206\u6790\u547d\u4ee4<\/h2>\n<blockquote><p>\n\u53c2\u8003\uff1a  <\/p>\n<ul>\n<li><a href=\"https:\/\/zhuanlan.zhihu.com\/p\/526432016\">linux\u7cfb\u7edf\u5206\u6790\u4e4b\u5de5\u5177\u5927\u5168(\u89c2\u6d4b\uff0c\u6027\u80fd\u5206\u6790\u7b49)<\/a>  <\/li>\n<li><a href=\"https:\/\/www.linuxprobe.com\/liaoliao-linux-command.html\">Linux\u5e38\u7528\u68c0\u6d4b\u6027\u80fd\u768410\u4e2a\u57fa\u672c\u547d\u4ee4<\/a><br \/>\n<img decoding=\"async\" src=\"https:\/\/note.youdao.com\/yws\/res\/1987\/WEBRESOURCEa476fbfc8a616978aa29aa567771019d\" alt=\"Linux Performance Observability Tools\" \/><\/li>\n<\/ul>\n<\/blockquote>\n<ul>\n<li>\nuptime<br \/>\n\u67e5\u770b\u8ba1\u7b97\u673a\u542f\u52a8\u65f6\u95f4\u4fe1\u606f\u53ca\u5e73\u5747\u8d1f\u8f7d\u60c5\u51b5\uff0c1min\u30015min\u300115min\u5185\u7684\u5e73\u5747\u8d1f\u8f7d\u3002<\/p>\n<pre><code class=\"language-shell\">[root@localhost \/]# uptime\n14:02:14 up  3:13,  1 user,  load average: 0.61, 0.52, 0.43<\/code><\/pre>\n<\/li>\n<li>\ntop<br \/>\n\u67e5\u770b\u8ba1\u7b97\u673a\u5f53\u524d\u8d1f\u8f7d\u60c5\u51b5\uff0c\u66f4\u591a\u6307\u6807\u7edf\u8ba1\uff0c\u5c55\u793a\u8fdb\u7a0b\u4ee5\u53ca\u7cfb\u7edf\u5168\u5c40\u7684cpu\uff0c\u5185\u5b58\u7b49\u4fe1\u606f<br \/>\n<code>top -hv | -bcHiOSs -d secs -n max -u|U user -p pid(s) -o field -w [cols]<\/code><br \/>\n\u53c2\u8003\uff1a<a href=\"https:\/\/zhuanlan.zhihu.com\/p\/623777553?utm_id=0\">linux \u547d\u4ee4\uff1atop \u8be6\u89e3<\/a><\/p>\n<pre><code class=\"language-shell\">[root@localhost \/]# top \ntop - 14:52:55 up  4:03,  1 user,  load average: 0.15, 0.09, 0.17\nTasks: 198 total,   1 running, 197 sleeping,   0 stopped,   0 zombie\n%Cpu(s):  4.1 us,  0.3 sy,  0.0 ni, 95.6 id,  0.0 wa,  0.0 hi,  0.0 si,  0.0 st\nKiB Mem :  5077260 total,   410392 free,  2592288 used,  2074580 buff\/cache\nKiB Swap:  1048572 total,  1048572 free,        0 used.  2181756 avail Mem \n\n  PID USER      PR  NI    VIRT    RES    SHR S %CPU %MEM     TIME+ COMMAND                                                                                                                                                                 \n 2483 root      20   0  720736  14852   4160 S  1.3  0.3   0:08.04 containerd-shim                                                                                                                                                         \n 2342 root      20   0  720736  14472   4184 S  1.0  0.3   0:08.32 containerd-shim                                                                                                                                                         \n 4264 gonait    20   0 4200644 939184  36492 S  1.0 18.5  10:19.67 java                                                                                                                                                                    \n 2543 gonait    20   0   11.1g 399700  23408 S  0.7  7.9   2:52.88 node                                                                                                                                                                    \n  402 root      20   0       0      0      0 S  0.3  0.0   0:02.50 xfsaild\/dm-0                                                                                                                                                            \n 2390 root      20   0  720480  14508   4160 S  0.3  0.3   0:07.69 containerd-shim                                                                                                                                                         \n 4082 gdm       20   0  714396  14716   9580 S  0.3  0.3   0:01.20 gsd-color                                                                                                                                                               \n20194 root      20   0  164300   2428   1616 R  0.3  0.0   0:00.09 top                                                                                                                                                                     \n    1 root      20   0  128420   7116   4216 S  0.0  0.1   0:02.93 systemd                                                                                                                                                                 \n    2 root      20   0       0      0      0 S  0.0  0.0   0:00.01 kthreadd                                                                                                                                                                \n    4 root       0 -20       0      0      0 S  0.0  0.0   0:00.00 kworker\/0:0H                        <\/code><\/pre>\n<\/li>\n<li>\nvmstat<br \/>\n\u6253\u5370\u8fdb\u7a0b\u3001\u5185\u5b58\u3001\u4ea4\u6362\u5206\u533a\u3001IO\u548cCPU\u7b49\u7684\u7edf\u8ba1\u4fe1\u606f<br \/>\n<code>vmstat [options] [delay [count]]<\/code><\/p>\n<pre><code class=\"language-shell\">[root@localhost \/]# vmstat 10\nprocs -----------memory---------- ---swap-- -----io---- -system-- ------cpu-----\n r  b   swpd   free   buff  cache   si   so    bi    bo   in   cs us sy id wa st\n 3  0      0 407520   1080 2074708    0    0   165    71 1073  718  8  1 91  1  0\n 0  0      0 460616   1080 2074560    0    0     0    24  970  683  2  1 98  0  0\n 0  0      0 408968   1080 2074728    0    0     0    20 1091  711  7  1 92  0  0<\/code><\/pre>\n<\/li>\n<li>\nmpstat<br \/>\n\u6253\u5370CPU\u7684\u7edf\u8ba1\u4fe1\u606f\uff0c\u67e5\u770bCPU\u8c03\u5ea6\u60c5\u51b5<br \/>\n<code>mpstat [ \u9009\u9879 ] [ &lt;\u65f6\u95f4\u95f4\u9694&gt; [ &lt;\u6b21\u6570&gt; ] ]<\/code><\/p>\n<pre><code class=\"language-shell\">[root@localhost \/]# mpstat 1\nLinux 3.10.0-1160.90.1.el7.x86_64 (localhost.localdomain)   2023\u5e7411\u670823\u65e5     _x86_64_    (1 CPU)\n\n15\u65f615\u520638\u79d2  CPU    %usr   %nice    %sys %iowait    %irq   %soft  %steal  %guest  %gnice   %idle\n15\u65f615\u520639\u79d2  all   19.19    0.00    1.01    0.00    0.00    0.00    0.00    0.00    0.00   79.80\n15\u65f615\u520640\u79d2  all    1.02    0.00    0.00    0.00    0.00    0.00    0.00    0.00    0.00   98.98\n15\u65f615\u520641\u79d2  all    1.02    0.00    0.00    0.00    0.00    0.00    0.00    0.00    0.00   98.98\n15\u65f615\u520642\u79d2  all    1.01    0.00    0.00    0.00    0.00    0.00    0.00    0.00    0.00   98.99\n15\u65f615\u520643\u79d2  all    0.00    0.00    1.00    0.00    0.00    0.00    0.00    0.00    0.00   99.00<\/code><\/pre>\n<\/li>\n<li>\npidstat<br \/>\n\u6253\u5370\u8fdb\u7a0b\u7684CPU\u5360\u7528\u60c5\u51b5<br \/>\n<code>pidstat [ \u9009\u9879 ] [ &lt;\u65f6\u95f4\u95f4\u9694&gt; [ &lt;\u6b21\u6570&gt; ] ]<\/code><\/p>\n<pre><code class=\"language-shell\">[root@localhost \/]# pidstat 3\nLinux 3.10.0-1160.90.1.el7.x86_64 (localhost.localdomain)   2023\u5e7411\u670823\u65e5     _x86_64_    (1 CPU)\n\n15\u65f622\u520612\u79d2   UID       PID    %usr %system  %guest    %CPU   CPU  Command\n15\u65f622\u520615\u79d2     0      1176    0.34    0.00    0.00    0.34     0  rsyslogd\n15\u65f622\u520615\u79d2    42      1652    0.34    0.00    0.00    0.34     0  gnome-shell\n15\u65f622\u520615\u79d2   999      2191    0.00    0.34    0.00    0.34     0  mysqld\n15\u65f622\u520615\u79d2  1000      2543    0.34    0.34    0.00    0.68     0  node\n15\u65f622\u520615\u79d2  1000      4264    1.01    0.34    0.00    1.35     0  java\n\n15\u65f622\u520615\u79d2   UID       PID    %usr %system  %guest    %CPU   CPU  Command\n15\u65f622\u520618\u79d2   999      2279    0.34    0.00    0.00    0.34     0  mongod\n15\u65f622\u520618\u79d2  1000      2543    1.01    0.00    0.00    1.01     0  node\n15\u65f622\u520618\u79d2  1000      4264    0.34    0.00    0.00    0.34     0  java\n15\u65f622\u520618\u79d2     0     22208    0.00    0.34    0.00    0.34     0  pidstat<\/code><\/pre>\n<\/li>\n<li>\niostat<br \/>\n\u7edf\u8ba1\u7cfb\u7edf\u7684io\u8f93\u5165\u8f93\u51fa\u60c5\u51b5<br \/>\n<code>iostat [ \u9009\u9879 ] [ &lt;\u65f6\u95f4\u95f4\u9694&gt; [ &lt;\u6b21\u6570&gt; ] ]<\/code><\/p>\n<pre><code class=\"language-shell\">[root@localhost \/]# iostat 3\nLinux 3.10.0-1160.90.1.el7.x86_64 (localhost.localdomain)   2023\u5e7411\u670823\u65e5     _x86_64_    (1 CPU)\n\navg-cpu:  %user   %nice %system %iowait  %steal   %idle\n           7.51    0.00    1.02    0.49    0.00   90.98\n\nDevice:            tps    kB_read\/s    kB_wrtn\/s    kB_read    kB_wrtn\nsda               9.35       156.54        69.60    2551850    1134585\ndm-0              9.97       155.77        79.31    2539282    1292927\ndm-1              0.01         0.14         0.00       2204          0<\/code><\/pre>\n<\/li>\n<li>\nfree<br \/>\n<code>free [options]<\/code><br \/>\n\u7edf\u8ba1\u7cfb\u7edf\u5185\u5b58\u4f7f\u7528\u60c5\u51b5<\/p>\n<pre><code class=\"language-shell\">[root@localhost \/]# free -ht\n              total        used        free      shared  buff\/cache   available\nMem:           4.8G        2.5G        392M         11M        2.0G        2.1G\nSwap:          1.0G          0B        1.0G\nTotal:         5.8G        2.5G        1.4G<\/code><\/pre>\n<\/li>\n<li>\nsar<br \/>\nsar\uff08System Activity Reporter \u7cfb\u7edf\u6d3b\u52a8\u60c5\u51b5\u62a5\u544a\uff09\u662f\u76ee\u524d Linux \u4e0a\u6700\u4e3a\u5168\u9762\u7684\u7cfb\u7edf\u6027\u80fd\u5206\u6790\u5de5\u5177\u4e4b\u4e00\uff0c\u53ef\u4ee5\u4ece\u591a\u65b9\u9762\u5bf9\u7cfb\u7edf\u7684\u6d3b\u52a8\u8fdb\u884c\u62a5\u544a\uff0c\u5305\u62ec\uff1a\u6587\u4ef6\u7684\u8bfb\u5199\u60c5\u51b5\u3001\u7cfb\u7edf\u8c03\u7528\u7684\u4f7f\u7528\u60c5\u51b5\u3001\u78c1\u76d8 I\/O\u3001CPU \u6548\u7387\u3001\u5185\u5b58\u4f7f\u7528\u72b6\u51b5\u3001\u8fdb\u7a0b\u6d3b\u52a8\u53ca IPC \u6709\u5173\u7684\u6d3b\u52a8\u7b49\u3002<br \/>\n<code>sar [ \u9009\u9879 ] [ &lt;\u65f6\u95f4\u95f4\u9694&gt; [ &lt;\u6b21\u6570&gt; ] ]<\/code><br \/>\n\u53c2\u8003\uff1a<a href=\"https:\/\/zhuanlan.zhihu.com\/p\/631105382?utm_id=0\">Linux\u5fc5\u4f1a\u57fa\u7840\u547d\u4ee4-sar\u547d\u4ee4<\/a><\/p>\n<pre><code class=\"language-shell\"># \u67e5\u770bcpu\u6d3b\u52a8\u60c5\u51b5 \n[root@localhost \/]# sar -u 1 3\nLinux 3.10.0-1160.90.1.el7.x86_64 (localhost.localdomain)   2023\u5e7411\u670823\u65e5     _x86_64_    (1 CPU)\n\n15\u65f656\u520631\u79d2     CPU     %user     %nice   %system   %iowait    %steal     %idle\n15\u65f656\u520632\u79d2     all     50.51      0.00     11.11      0.00      0.00     38.38\n15\u65f656\u520633\u79d2     all      2.04      0.00      0.00      0.00      0.00     97.96\n15\u65f656\u520634\u79d2     all      0.00      0.00      0.00      0.00      0.00    100.00\n\u5e73\u5747\u65f6\u95f4:     all     17.57      0.00      3.72      0.00      0.00     78.72<\/code><\/pre>\n<\/li>\n<li>\nnetstat<br \/>\nnetstat \u547d\u4ee4\u7528\u4e8e\u663e\u793a\u5404\u79cd\u7f51\u7edc\u76f8\u5173\u4fe1\u606f\uff0c\u5982\u7f51\u7edc\u8fde\u63a5\uff0c\u8def\u7531\u8868\uff0c\u63a5\u53e3\u72b6\u6001 (Interface Statistics)\uff0cmasquerade \u8fde\u63a5\uff0c\u591a\u64ad\u6210\u5458 (Multicast Memberships) \u7b49\u7b49\u3002<br \/>\n<code>netstat [-vWeenNcCF] [&lt;Af&gt;] -r         netstat {-V|--version|-h|--help}<\/code><br \/>\n<code>netstat [-vWnNcaeol] [&lt;Socket&gt; ...]<\/code><br \/>\n<code>netstat { [-vWeenNac] -I[&lt;Iface&gt;] | [-veenNac] -i | [-cnNe] -M | -s [-6tuw] } [delay]<\/code><br \/>\n\u53c2\u8003\uff1a<a href=\"https:\/\/www.linuxprobe.com\/netstat-command-explanation.html\">netstat\u547d\u4ee4\u8be6\u89e3<\/a><\/p>\n<pre><code class=\"language-shell\">[root@localhost \/]# netstat -anp | grep 9200\ntcp        0      0 0.0.0.0:9200            0.0.0.0:*               LISTEN      2113\/docker-proxy   \ntcp        0      0 172.17.0.1:56982        172.17.0.2:9200         ESTABLISHED 2113\/docker-proxy   \ntcp        0      0 172.17.0.1:56986        172.17.0.2:9200         ESTABLISHED 2113\/docker-proxy   \ntcp        0      0 192.168.211.200:9200    172.17.0.6:35130        ESTABLISHED 2113\/docker-proxy <\/code><\/pre>\n<\/li>\n<\/ul>\n","protected":false},"excerpt":{"rendered":"<p>Linux 25.8K \u5f00\u6e90\u7684 Linu [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":441,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"_uag_custom_page_level_css":"","site-sidebar-layout":"default","site-content-layout":"","ast-site-content-layout":"default","site-content-style":"default","site-sidebar-style":"default","ast-global-header-display":"","ast-banner-title-visibility":"","ast-main-header-display":"","ast-hfb-above-header-display":"","ast-hfb-below-header-display":"","ast-hfb-mobile-header-display":"","site-post-title":"","ast-breadcrumbs-content":"","ast-featured-img":"","footer-sml-layout":"","theme-transparent-header-meta":"default","adv-header-id-meta":"","stick-header-meta":"default","header-above-stick-meta":"","header-main-stick-meta":"","header-below-stick-meta":"","astra-migrate-meta-layouts":"set","ast-page-background-enabled":"default","ast-page-background-meta":{"desktop":{"background-color":"var(--ast-global-color-4)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-gradient":""},"tablet":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-gradient":""},"mobile":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-gradient":""}},"ast-content-background-meta":{"desktop":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-gradient":""},"tablet":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-gradient":""},"mobile":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-gradient":""}},"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[1],"tags":[],"class_list":["post-435","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-uncategorized"],"acf":[],"views":1036,"jetpack_sharing_enabled":true,"jetpack_featured_media_url":"https:\/\/www.gonait.com\/wp-content\/uploads\/2024\/02\/Linux.png","uagb_featured_image_src":{"full":["https:\/\/www.gonait.com\/wp-content\/uploads\/2024\/02\/Linux.png",691,389,false],"thumbnail":["https:\/\/www.gonait.com\/wp-content\/uploads\/2024\/02\/Linux-150x150.png",150,150,true],"medium":["https:\/\/www.gonait.com\/wp-content\/uploads\/2024\/02\/Linux-300x169.png",300,169,true],"medium_large":["https:\/\/www.gonait.com\/wp-content\/uploads\/2024\/02\/Linux.png",691,389,false],"large":["https:\/\/www.gonait.com\/wp-content\/uploads\/2024\/02\/Linux.png",691,389,false],"1536x1536":["https:\/\/www.gonait.com\/wp-content\/uploads\/2024\/02\/Linux.png",691,389,false],"2048x2048":["https:\/\/www.gonait.com\/wp-content\/uploads\/2024\/02\/Linux.png",691,389,false]},"uagb_author_info":{"display_name":"\u53e4\u4e43\u7279","author_link":"https:\/\/www.gonait.com\/?author=2"},"uagb_comment_info":0,"uagb_excerpt":"Linux 25.8K \u5f00\u6e90\u7684 Linu [&hellip;]","_links":{"self":[{"href":"https:\/\/www.gonait.com\/index.php?rest_route=\/wp\/v2\/posts\/435","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.gonait.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.gonait.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.gonait.com\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.gonait.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=435"}],"version-history":[{"count":3,"href":"https:\/\/www.gonait.com\/index.php?rest_route=\/wp\/v2\/posts\/435\/revisions"}],"predecessor-version":[{"id":833,"href":"https:\/\/www.gonait.com\/index.php?rest_route=\/wp\/v2\/posts\/435\/revisions\/833"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.gonait.com\/index.php?rest_route=\/wp\/v2\/media\/441"}],"wp:attachment":[{"href":"https:\/\/www.gonait.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=435"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.gonait.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=435"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.gonait.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=435"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}